-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Labels
c++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 concepts
Description
Clang rejects this code
#include <concepts>
template <decltype(auto) a>
struct S {
static constexpr int i = 42;
};
template <decltype(auto) a>
requires true
struct S<a> {
static constexpr int i = 0;
};
static constexpr int a = 0;
void test() {
static_assert(S<a>::i == 0); // Ok
static_assert(S<(a)>::i == 0); // Fails
}
https://godbolt.org/z/hsb4c5WE3
Clang picks the primary template when a NTTP is a reference type, even if there is a more constrained specialization.
Other compiler accept this code.
Metadata
Metadata
Assignees
Labels
c++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 concepts