2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / ext / typedef-init.C
blob1b2a05db63c810826bbd5f75000b2106309cb9ac
1 /* { dg-do compile } */
2 /* { dg-options "-fpermissive" } // suppress default -pedantic-errors */
4 /* This code used to be a legitimate, if dubious, extension.  However,
5    it's been broken since GCC 3.0 (caused ICE) and we have now removed
6    the extension.  See PR c/7353.
8    For cases A and C, C++ issues a warning in addition to the error,
9    since this construct appears to be a case of implicit int
10    (forbidden in std. C++) until we get to the equals sign.  */
12 /* Case A: just the bare name = initializer.  */
14 typedef A = 0;  /* { dg-error "initialized" "A" } */
15                 /* { dg-warning "no type" "A warns" { target *-*-* } 14 } */
16 A a;            /* { dg-bogus "" "A error cascade" } */
18 /* Case B: with a type also.  */
20 typedef int B = 0;  /* { dg-error "initialized" "B" } */
21 B b;                /* { dg-bogus "" "B error cascade" } */
23 /* C and D are the same as A and B, but wrapped in a structure;
24    field declarations go by a different code path in C++ (ick).  */
26 struct S {
27   typedef C = 0; /* { dg-error "initialized" "C" } */
28                  /* { dg-warning "no type" "C warns" { target *-*-* } 27 } */
29   C c;           /* { dg-bogus "" "C error cascade" } */
31   typedef int D = 0; /* { dg-error "initialized" "D" } */
32   D d;               /* { dg-bogus "" "D error cascade" } */