C++ 是否定义了以下代码的行为:
template <class T>
concept C = true;
struct C {};
template <C T>
struct A {};
template <struct C T>
struct B {};
int main() {
// when using MSVC
C c; // error
bool b = C<int>; // also error
// and can't use concept C anywhere other
// than the template parameter list
constexpr struct C cc {};
struct C c2; // ok
A<int> a; // ok
A<cc> a; // error
B<cc> b; // ok
return …Run Code Online (Sandbox Code Playgroud)