Closed
Description
Tested with clang-trunk.
Here's the code:
template<typename T>
class Test {
public:
static constexpr int val = 16;
constexpr Test()
requires (val == 16);
};
template<typename T>
constexpr Test<T>::Test() // error: out-of-line definition of 'Test<T>' does not match any declaration in 'Test<T>'
requires (val == 16) // error: use of undeclared identifier 'val'
{
}
int main()
{
Test<int> test();
return 0;
}
I tested with GCC and it gives no errors.
Replacing val == 16
with Test<T>::val == 16
removes the 'undeclared identifier...' error but 'out-of-line...' error remains.
With no template parameters the code compiles if you write Test::val == 16
.
Metadata
Metadata
Assignees
Type
Projects
Status
Done