diff mbox

[C++] PR 58457

Message ID 5239C6F5.5000709@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Sept. 18, 2013, 3:29 p.m. UTC
Hi,

in this 4.8/4.9 Regression having to do with using declarations we ICE 
at the gcc_assert in instantiate_type:

    gcc_assert (TREE_CODE (rhs) == ADDR_EXPR
            || TREE_CODE (rhs) == COMPONENT_REF
            || really_overloaded_fn (rhs)
            || (flag_ms_extensions && TREE_CODE (rhs) == FUNCTION_DECL));

because really_overloaded_fn (rhs) is false. Marek figured out that the 
ICE started with the representation change:

     http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=184873

which means that OVERLOADs are *always* built for using-decls. Thus I 
think it could make sense to simply loosen a bit the gcc_assert. The 
below passes testing + fixes c++/57444 too.

Thanks,
Paolo.

//////////////////////
/cp
2013-09-18

	PR c++/58457
	* class.c (instantiate_type): Loosen a bit the gcc_assert.

/testsuite
2013-09-18

	PR c++/58457
	* g++.dg/parse/using4.C: New.

Comments

Jason Merrill Sept. 18, 2013, 5:38 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: cp/class.c
===================================================================
--- cp/class.c	(revision 202703)
+++ cp/class.c	(working copy)
@@ -7627,7 +7627,7 @@  instantiate_type (tree lhstype, tree rhs, tsubst_f
      dependent on overload resolution.  */
   gcc_assert (TREE_CODE (rhs) == ADDR_EXPR
 	      || TREE_CODE (rhs) == COMPONENT_REF
-	      || really_overloaded_fn (rhs)
+	      || is_overloaded_fn (rhs)
 	      || (flag_ms_extensions && TREE_CODE (rhs) == FUNCTION_DECL));
 
   /* This should really only be used when attempting to distinguish
Index: testsuite/g++.dg/parse/using4.C
===================================================================
--- testsuite/g++.dg/parse/using4.C	(revision 0)
+++ testsuite/g++.dg/parse/using4.C	(working copy)
@@ -0,0 +1,20 @@ 
+// PR c++/58457
+
+struct allocator
+{
+  void operator delete (void*);
+  void* operator new (__SIZE_TYPE__, void*);
+};
+
+struct type : public allocator
+{
+  type() {}
+  using allocator::operator new;
+  using allocator::operator delete;
+};
+
+int main()
+{
+  new (0) type;
+  return 0;
+}