45 lines · cpp
1// RUN: %clang_cc1 -std=c++20 -verify -fsyntax-only %s2 3namespace a {4 template <typename T>5 concept C1 = true; // #C16 7 template <typename T>8 auto V1 = true; // #V19 10 namespace b {11 template <typename T>12 concept C2 = true; // #C213 template <typename T>14 auto V2 = true; // #V215 }16}17 18template <typename T>19concept C3 = true; // #C320template <typename T>21auto V3 = true; // #V322template <template <typename T> typename C>23constexpr bool test = true;24 25static_assert(test<a::C1>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \26 // expected-note@#C1 {{here}}27static_assert(test<a::b::C2>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \28 // expected-note@#C2 {{here}}29static_assert(test<C3>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \30 // expected-note@#C3 {{here}}31 32static_assert(test<a::V1>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \33 // expected-note@#V1 {{here}}34static_assert(test<a::b::V2>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \35 // expected-note@#V2 {{here}}36static_assert(test<V3>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \37 // expected-note@#V3 {{here}}38 39 40void f() {41 C3 t1 = 0; // expected-error {{expected 'auto' or 'decltype(auto)' after concept name}}42 a::C1 t2 = 0; // expected-error {{expected 'auto' or 'decltype(auto)' after concept name}}43 a::b::C2 t3 = 0; // expected-error {{expected 'auto' or 'decltype(auto)' after concept name}}44}45