* doc/invoke.texi: Document -std=c++17 and -std=gnu++17 and document
[official-gcc.git] / gcc / testsuite / g++.dg / concepts / explicit-spec1.C
blob38730680e14d9360718fe0c33c786c718045522f
1 // { dg-do run }
2 // { dg-options "-std=c++17 -fconcepts" }
4 #include <cassert>
6 template<typename T>
7   concept bool C() { return __is_class(T); }
9 template<typename T>
10   concept bool D() { return C<T>() && __is_empty(T); }
12 struct X { } x;
13 struct Y { int n; } y;
15 template<typename T> void g(T) { } // #1
16 template<C T> void g(T) { }        // #2
17 template<D T> void g(T) { }     // #3
19 int called;
21 template<> void g(int) { called = 1; } // Specialization of #1
22 template<> void g<X>(X) { called = 2; } // Specialization of #3
23 template<> void g(Y) { called = 3; } // Specialization of #2
25 int main() {
26   g(0);
27   assert(called == 1);
28   g(x);
29   assert(called == 2);
30   g(y);
31   assert(called == 3);