OSDN Git Service

* g++.dg/lookup/anon2.C: New test.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Nov 2002 22:08:36 +0000 (22:08 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Nov 2002 22:08:36 +0000 (22:08 +0000)
* parse.y (class_head_defn): Set CLASSTYPE_DECLARED_CLASS for
anonymous structs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59647 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/parse.y
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/anon2.C [new file with mode: 0644]

index d22e538..7ff2a31 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-29  Joe Buck <jbuck@synopsys.com>
+
+       * parse.y (class_head_defn): Set CLASSTYPE_DECLARED_CLASS for
+       anonymous structs.
+       
 2002-11-29  Mark Mitchell  <mark@codesourcery.com>
 
        * class.c (walk_subobject_offsets): Recur on binfos as well as on
index 78cf991..0be461e 100644 (file)
@@ -2524,6 +2524,8 @@ class_head_defn:
                                                         make_anon_name (), 
                                                         0));
                  $$.new_type_flag = 0;
+                 CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($$.t))
+                   = $1 == class_type_node;
                  yyungetc ('{', 1);
                }
        ;
index afc3178..ad7f449 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-29  Joe Buck <jbuck@synopsys.com>
+
+       * g++.dg/lookup/anon2.C: New test.
+
 2002-11-28  Kazu Hirata  <kazu@cs.umass.edu>
 
        * gcc.c-torture/execute/strct-varg-1.x: Remove xfail on the
diff --git a/gcc/testsuite/g++.dg/lookup/anon2.C b/gcc/testsuite/g++.dg/lookup/anon2.C
new file mode 100644 (file)
index 0000000..b0a7c07
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-do compile }
+// { dg-options "" }
+
+class { int i; } a; // { dg-error "private" }
+void foo() { a.i; } // { dg-error "context" }
+