diff mbox

C++ PATCHes for inheriting ctor issues

Message ID 50AA39DB.3030800@redhat.com
State New
Headers show

Commit Message

Jason Merrill Nov. 19, 2012, 1:53 p.m. UTC
When I implemented inheriting constructors, I thought that the wording 
that said that base copy/move constructors are not inherited was a 
wording problem, but discussion on the reflector indicates that it was 
intended, so that wrapper classes act like strong typedefs rather than 
drop-in replacements.  So the first patch implements that.

In 55261 we were using CLASSTYPE_CONSTRUCTORS while the type still had 
undeclared lazy constructors, so we need to use lookup_fnfields to get 
the lazy declarations.

For 55262 we need to set DECL_PARM_INDEX on the inherited parameters.

Tested x86_64-pc-linux-gnu, applying to trunk.
diff mbox

Patch

commit bdfd9834c861aaead76fa86ace1b9c70409443d0
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Nov 15 11:58:50 2012 -0500

    	PR c++/55262
    	* method.c (implicitly_declare_fn): Set DECL_PARM_INDEX on
    	the parms of an inheriting ctor.

diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 6458032..6dcb63a 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1663,10 +1663,14 @@  implicitly_declare_fn (special_function_kind kind, tree type,
   else if (kind == sfk_inheriting_constructor)
     {
       tree *p = &DECL_ARGUMENTS (fn);
+      int index = 1;
       for (tree parm = inherited_parms; parm != void_list_node;
 	   parm = TREE_CHAIN (parm))
 	{
 	  *p = cp_build_parm_decl (NULL_TREE, TREE_VALUE (parm));
+	  retrofit_lang_decl (*p);
+	  DECL_PARM_LEVEL (*p) = 1;
+	  DECL_PARM_INDEX (*p) = index++;
 	  DECL_CONTEXT (*p) = fn;
 	  p = &DECL_CHAIN (*p);
 	}
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor10.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor10.C
index de57453..56c5bd6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/inh-ctor10.C
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor10.C
@@ -1,4 +1,4 @@ 
-// { dg-options "-std=c++11" }
+// { dg-options "-std=c++11 -g" }
 
 struct A
 {