summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/other/field1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/other/field1.C')
-rw-r--r--gcc/testsuite/g++.dg/other/field1.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/other/field1.C b/gcc/testsuite/g++.dg/other/field1.C
new file mode 100644
index 000000000..61a9df695
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/field1.C
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 9 Jul 2003 <nathan@codesourcery.com>
+
+// PR c++ 9483. accepted fields with same name as class
+
+struct test
+{
+ char test; // { dg-error "with same name as class" "" }
+ test();
+};
+
+template <typename T> struct X
+{
+ char X; // { dg-error "with same name as class" "" }
+ X ();
+};
+
+template <> struct X<int> {
+ char X; // { dg-error "with same name as class" "" }
+ X();
+};
+
+X<float> i; // { dg-message "instantiated from" "" }