Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.bugs/900127_02.C

raw
1 // { dg-do assemble }
2 // g++ 1.36.1 bug 900127_02
3
4 // g++ (mostly) keeps separate name spaces for the declarations of data
5 // objects and functions.
6
7 // This means that a single name may be declared as both a data object and
8 // a function within a given scope.
9
10 // This fact allows programmers to write code which is not portable to the
11 // Cfront translator (which keeps a single namespace for these entities).
12
13 // This can also lead to ambiguity when the & (address-of) operator is used.
14
15 // Cfront 2.0 passes this test.
16
17 // keywords: name spaces, overloading
18
19 int global0; // { dg-message "" }
20 int global0 (); // { dg-error "" }
21
22 int global1 (); // { dg-message "" } xref for below
23 int global1; // { dg-error "" } caught
24
25 struct struct_0 {
26 int class_local (); // { dg-message "" }
27 int class_local; // { dg-error "" }
28 };
29
30 struct struct_1 {
31 int class_local; // { dg-message "" }
32 int class_local (); // { dg-error "" }
33 };
34
35 void function_0 ()
36 {
37 int function_0_local; // { dg-message "" }
38 extern int function_0_local (); // { dg-error "" }
39 }
40
41 void function_1 ()
42 {
43 int function_1_local (); // { dg-message "" }
44 extern int function_1_local; // { dg-error "" }
45 }
46
47 int main () { return 0; }