2 // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3 // Try to find out when the digraph '<:' is used as a mistake, and parse it
4 // correctly to avoid cascaded errors.
14 static void method(void) {}
18 typename Foo<::B>::template Nested<::B> n; // { dg-error "cannot begin|alternate spelling" }
19 n.template Nested<B>::method();
20 n.template Nested<::B>::method(); // { dg-error "cannot begin|alternate spelling" }
22 Nested<::B>::method(); // { dg-error "cannot begin|alternate spelling" }
26 template <int N> struct Foo2 {};
27 template struct Foo2<::B>; // { dg-error "cannot begin|alternate spelling|type/value mismatch|expected a constant" }
33 Foo<::B> f; // { dg-error "cannot begin|alternate spelling" }
35 f.Foo<::B>::method(); // { dg-error "cannot begin|alternate spelling" }
37 // Check cases where we the token sequence is the correct one, but there
38 // was no digraph or whitespaces in the middle, so we should not emit
39 // the special error message.
40 Foo<: :B> k2; // { dg-bogus "cannot begin|alternate spelling" "smart error should not be triggered here" }
41 Foo[:B> k1; // { dg-bogus "cannot begin|alternate spelling" "smart error should not be triggered here" }
42 // { dg-error "" "" { target *-*-* } 40 }
43 // { dg-error "" "" { target *-*-* } 41 }
49 template struct Foo<::B>; // { dg-error "cannot begin|alternate spelling" }
51 // On the first error message, an additional note about the use of
52 // -fpermissive should be present
53 // { dg-error "-fpermissive" "-fpermissive" { target *-*-* } 18 }