diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-12 20:47:15 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-12 20:47:15 +0000 |
commit | 65e921ca1d1efd8e13443b011de59fb711195917 (patch) | |
tree | f05abda8609ab1a622c223269ac2c8b5692d6b47 /gcc | |
parent | b862f263d5146ad1c75d1dbfa5a2bc5459ebff32 (diff) | |
download | gcc-65e921ca1d1efd8e13443b011de59fb711195917.tar.gz |
PR c++/56285
* method.c (add_one_base_init): Handle base constructor
taking rvalue reference parm.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195990 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/method.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/inh-ctor16.C | 15 |
3 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0d4d5cfb27b..bc4e41caa7b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-02-12 Jason Merrill <jason@redhat.com> + PR c++/56285 + * method.c (add_one_base_init): Handle base constructor + taking rvalue reference parm. + PR c++/56291 * semantics.c (sort_constexpr_mem_initializers): Handle vptr out of order. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index a1bab95049c..ff29b596892 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -500,7 +500,8 @@ add_one_base_init (tree binfo, tree parm, bool move_p, tree inh, for (; parm; parm = DECL_CHAIN (parm)) { tree exp = convert_from_reference (parm); - if (TREE_CODE (TREE_TYPE (parm)) != REFERENCE_TYPE) + if (TREE_CODE (TREE_TYPE (parm)) != REFERENCE_TYPE + || TYPE_REF_IS_RVALUE (TREE_TYPE (parm))) exp = move (exp); *p = build_tree_list (NULL_TREE, exp); p = &TREE_CHAIN (*p); diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor16.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor16.C new file mode 100644 index 00000000000..58e848b9c8f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor16.C @@ -0,0 +1,15 @@ +// PR c++/56285 +// { dg-options -std=c++11 } + +struct foo { + explicit foo(int&&) {} +}; + +struct bar: private foo { + using foo::foo; +}; + +int main() +{ + bar b { 42 }; +} |