]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/53995 (Overload resolution fails with enum argument, says <anonymous enum>)
authorJason Merrill <jason@redhat.com>
Wed, 18 Jul 2012 02:47:59 +0000 (22:47 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 18 Jul 2012 02:47:59 +0000 (22:47 -0400)
PR c++/53995
* decl.c (finish_enum_value_list): Only call
insert_late_enum_def_into_classtype_sorted_fields in class scope.

From-SVN: r189598

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/enum9.C [new file with mode: 0644]

index c1465ccc385d4d2c704e061ef19ba1ef002b9376..ef4e8acdb997868700aa7ea948e9507d51786e02 100644 (file)
@@ -1,5 +1,9 @@
 2012-07-17  Jason Merrill  <jason@redhat.com>
 
+       PR c++/53995
+       * decl.c (finish_enum_value_list): Only call
+       insert_late_enum_def_into_classtype_sorted_fields in class scope.
+
        PR c++/53989
        * tree.c (build_cplus_array_type): Also add TYPE_CANONICAL
        to the list of variants.
index 84b78f6f1da8d0df1584eeca4490acbef78e734e..8a3163a4994529d3707cf78962d3f187c58d34eb 100644 (file)
@@ -12392,7 +12392,7 @@ finish_enum_value_list (tree enumtype)
   for (t = TYPE_MAIN_VARIANT (enumtype); t; t = TYPE_NEXT_VARIANT (t))
     TYPE_VALUES (t) = TYPE_VALUES (enumtype);
 
-  if (current_class_type
+  if (at_class_scope_p ()
       && COMPLETE_TYPE_P (current_class_type)
       && UNSCOPED_ENUM_P (enumtype))
     insert_late_enum_def_into_classtype_sorted_fields (enumtype,
index 2b1bb7b9c0f517d2526de36c89cd44b8c75e98c1..ac9f86b1ae94cf5b32d6b507be0d492ca1e45443 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-17  Jason Merrill  <jason@redhat.com>
+
+       PR c++/53995
+       * g++.dg/parse/enum9.C: New.
+
 2012-07-17  Kazu Hirata  <kazu@codesourcery.com>
            Sandra Loosemore  <sandra@codesourcery.com>
 
diff --git a/gcc/testsuite/g++.dg/parse/enum9.C b/gcc/testsuite/g++.dg/parse/enum9.C
new file mode 100644 (file)
index 0000000..559db31
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/53995
+
+enum E1 { e };
+void f(E1);
+
+struct A {
+  int i1,i2,i3,i4,i5,i6,i7,i8,i9,i10;
+  void g();
+  void h();
+};
+
+void A::g() { enum E2 { e }; }
+void A::h() { f(e); }