diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-07 07:07:07 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-07 07:07:07 +0000 |
commit | 6d84574d06901f5e333ccbbc163245cc4267253a (patch) | |
tree | c12092a2354ac3c5aa978d1c9dc718ab56108813 /gcc/cp/init.c | |
parent | 3ba8ab31ab7b3565c05aca5ee0b3026490626e2e (diff) | |
download | gcc-6d84574d06901f5e333ccbbc163245cc4267253a.tar.gz |
PR c++/10147
* call.c (initialize_reference): Tweak error message.
PR c++/12337
* init.c (build_new_1): Make sure that the expression returned is
not an lvalue.
PR c++/12344, c++/12236, c++/8656
* decl.c (start_function): Do not ignore attributes embedded in a
function declarator.
PR c++/12337
* g++.dg/init/new9.C: New test.
PR c++/12334, c++/12236, c++/8656
* g++.dg/ext/attrib8.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72183 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index fefda4b810d..50303456991 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2276,7 +2276,13 @@ build_new_1 (tree exp) } /* Convert to the final type. */ - return build_nop (pointer_type, rval); + rval = build_nop (pointer_type, rval); + + /* A new-expression is never an lvalue. */ + if (real_lvalue_p (rval)) + rval = build1 (NON_LVALUE_EXPR, TREE_TYPE (rval), rval); + + return rval; } static tree |