Debian Codegraph @

gcc/testsuite/g++.dg/concepts/decl-diagnose.C

raw
1 // { dg-do compile { target c++17 } }
2 // { dg-options "-fconcepts" }
3 // { dg-prune-output "concept definition syntax is" }
4
5 typedef concept int CINT; // { dg-error "'concept' cannot appear in a typedef declaration" }
6
7 void f(concept int); // { dg-error "a parameter cannot be declared 'concept'" }
8
9 template<typename T>
10 concept int f2() { return 0; } // { dg-error "function concepts are no longer supported" }
11 concept bool f3(); // { dg-error "14:function concepts are no longer supported" }
12 // { dg-error "keyword is not allowed" "" { target *-*-* } .-1 }
13
14 struct X
15 {
16 template<typename T>
17 concept int f4() { return 0; } // { dg-error "cannot be a member" }
18 concept f5 = true; // { dg-error "declared 'concept'" }
19 template<typename T>
20 static concept f6 = true; // { dg-error "declared 'concept'" }
21 static concept bool x; // { dg-error "declared 'concept'" }
22 // { dg-error "uninitialized 'const" "" { target *-*-* } .-1 }
23 // { dg-error "keyword is not allowed" "" { target *-*-* } .-2 }
24 concept int x2; // { dg-error "declared 'concept'" }
25 concept ~X(); // { dg-error "a destructor cannot be 'concept'" }
26 concept X(); // { dg-error "a constructor cannot be 'concept'" }
27 };
28
29 concept bool X2; // { dg-error "variable" }
30 // { dg-error "keyword is not allowed" "" { target *-*-* } .-1 }
31
32 template<typename T>
33 concept bool X3; // { dg-error "variable concepts" }
34 // { dg-error "keyword is not allowed" "" { target *-*-* } .-1 }
35
36 struct S {
37 template<typename T>
38 static concept bool C1 = true; // { dg-error "static data member" }
39 // { dg-error "keyword is not allowed" "" { target *-*-* } .-1 }
40 };