OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [g++.dg/] [ext/] [typedef-init.C] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* { dg-do compile } */
2
/* { dg-options "-fpermissive" } // suppress default -pedantic-errors */
3
 
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.
7
 
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.  */
11
 
12
/* Case A: just the bare name = initializer.  */
13
 
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" } */
17
 
18
/* Case B: with a type also.  */
19
 
20
typedef int B = 0;  /* { dg-error "initialized" "B" } */
21
B b;                /* { dg-bogus "" "B error cascade" } */
22
 
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).  */
25
 
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" } */
30
 
31
  typedef int D = 0; /* { dg-error "initialized" "D" } */
32
  D d;               /* { dg-bogus "" "D error cascade" } */
33
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.