OSDN Git Service

PR c++/30849
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / parse / error15.C
1 // { dg-do compile }
2 // Contributed by Volker Reichelt <reichelt at gcc dot gnu dot org> 
3 // PR c++/14008: Improve diagnostic on invalid types in declarators.
4
5 namespace N
6
7   template<int> struct A {};
8   struct C {};
9   int K;
10 }
11
12 N::A f2;              // { dg-error "without an argument list" }
13 N::INVALID f3;        // { dg-error "in namespace 'N' does not name a type" }
14 N::C::INVALID f4;     // { dg-error "in class 'N::C' does not name a type" }
15 N::K f6;              // { dg-error "in namespace 'N' does not name a type" }
16 typename N::A f7;     // { dg-error "without an argument list|outside of template" }
17
18 struct B
19 {
20   N::A f2;            // { dg-error "without an argument list" }
21   N::INVALID f3;      // { dg-error "in namespace 'N' does not name a type" }
22   N::C::INVALID f4;   // { dg-error "in class 'N::C' does not name a type" }
23   N::K f6;            // { dg-error "in namespace 'N' does not name a type" }
24   typename N::A f7;   // { dg-error "without an argument list|outside of template" }
25 };
26
27 template <int>
28 struct C
29 {
30   N::A f2;            // { dg-error "without an argument list" }
31   N::INVALID f3;      // { dg-error "in namespace 'N' does not name a type" }
32   N::C::INVALID f4;   // { dg-error "in class 'N::C' does not name a type" }
33   N::K f6;            // { dg-error "in namespace 'N' does not name a type" }
34   typename N::A f7;   // { dg-error "without an argument list" }
35 };
36
37 // { dg-bogus "" "bogus excess errors in declaration" { xfail *-*-* } 16 }