annotate gcc/testsuite/g++.dg/ext/typedef-init.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-options "-fpermissive" } // suppress default -pedantic-errors */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 /* This code used to be a legitimate, if dubious, extension. However,
kono
parents:
diff changeset
5 it's been broken since GCC 3.0 (caused ICE) and we have now removed
kono
parents:
diff changeset
6 the extension. See PR c/7353.
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 For cases A and C, C++ issues a warning in addition to the error,
kono
parents:
diff changeset
9 since this construct appears to be a case of implicit int
kono
parents:
diff changeset
10 (forbidden in std. C++) until we get to the equals sign. */
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 /* Case A: just the bare name = initializer. */
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 typedef A = 0; /* { dg-error "does not name a type" "A" } */
kono
parents:
diff changeset
15 A a; /* { dg-error "does not name a type" "A error cascade" } */
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 /* Case B: with a type also. */
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 typedef int B = 0; /* { dg-error "initialized" "B" } */
kono
parents:
diff changeset
20 B b; /* { dg-error "does not name a type" "B error cascade" } */
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 /* C and D are the same as A and B, but wrapped in a structure;
kono
parents:
diff changeset
23 field declarations go by a different code path in C++ (ick). */
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 struct S {
kono
parents:
diff changeset
26 typedef C = 0; /* { dg-error "does not name a type" "C" } */
kono
parents:
diff changeset
27 C c; /* { dg-error "" "C error cascade" } */
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 typedef int D = 0; /* { dg-error "initialized" "D" } */
kono
parents:
diff changeset
30 D d; /* { dg-bogus "" "D error cascade" } */
kono
parents:
diff changeset
31 };
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 template<int> void foo()
kono
parents:
diff changeset
34 {
kono
parents:
diff changeset
35 typedef int i = 0; /* { dg-error "is initialized" } */
kono
parents:
diff changeset
36 }