-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed as not planned
Closed as not planned
Copy link
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 conceptsdiverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issueinvalidResolved as invalid, i.e. not a bugResolved as invalid, i.e. not a bug
Description
Here the example where the function definition uses a requires clause whereas
the function declaration uses a concept applied directly to the template parameter type:
https://godbolt.org/z/YMxbrY5rP
template<typename T>
concept C = true;
// declaration:
template<C T>
class A1{
public:
template<C Tnest>
void f();
};
//definition:
template<C T>
template<typename Tnest>
requires C<Tnest>
void A1<T>::f(){};
Standard text in [temp.constr.decl]-p3 reads that the logical AND of all constraints need to be considered.
Indeed, gcc accepts it (MVSC does not).
Note that at the referred link, there is also another example with class A2, involving a constraint that is a logical OR of two other constraint, but all compilers fails if I explicit the OR in the requires clause... which seems to be fair, isn't it ?
Really, you can simplify the example by making classes as non-template, you would get the same results: https://godbolt.org/z/PdMzqG6z5
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 conceptsdiverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issueinvalidResolved as invalid, i.e. not a bugResolved as invalid, i.e. not a bug