Skip to content

Clang fails to compile when using std::tuple_size_v<T> in concept, but compiles with std::tuple_size<T>::value #125441

@Taw3e8

Description

@Taw3e8

Clang (and other compilers too) compile when this code uses ::value but fail to compile when _v is used (https://godbolt.org/z/b9ofY1vsT):

template<typename T>
concept check1 = requires {
	[]<std::size_t... Is>(std::index_sequence<Is...>) requires requires {
		(std::get<Is>(std::declval<T>()), ...);
	} {}(std::make_index_sequence<std::tuple_size<T>::value>{});         // diff
};

template<typename T>
concept check2 = requires {
	[]<std::size_t... Is>(std::index_sequence<Is...>) requires requires {
		(std::get<Is>(std::declval<T>()), ...);
	} {}(std::make_index_sequence<std::tuple_size_v<T>>{});              // diff
};


int main() {
	auto _ = check1<int>; // this is fine
        auto _ = check2<int>; // this is not
}

Is this behaviour correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueneeds-reductionLarge reproducer that should be reduced into a simpler form

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions