diff options
author | Jakub Jelinek <jakub@redhat.com> | 2001-02-16 23:30:06 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2001-02-16 23:30:06 +0100 |
commit | 2c1be3223f5bbc9e2238d15e8a48d37b1f02fdbe (patch) | |
tree | ec99a75428f993f32c99bfc7522559768ef6c379 | |
parent | f5bbdc0c54c34e18958bfb74fb7bb831ba05fa12 (diff) | |
download | gcc-2c1be3223f5bbc9e2238d15e8a48d37b1f02fdbe.zip gcc-2c1be3223f5bbc9e2238d15e8a48d37b1f02fdbe.tar.gz gcc-2c1be3223f5bbc9e2238d15e8a48d37b1f02fdbe.tar.bz2 |
call.c (convert_like_real): Create a temporary for non-lvalue.
* call.c (convert_like_real): Create a temporary for non-lvalue.
* g++.old-deja/g++.other/init16.C: Update the test so that it does
not need <string> and also tests the initialization at runtime.
From-SVN: r39776
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/call.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/init16.C | 27 |
4 files changed, 32 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6341bbe..d79146c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2001-02-16 Jakub Jelinek <jakub@redhat.com> + + * call.c (convert_like_real): Create a temporary for non-lvalue. + 2001-02-16 Jeffrey Oldham <oldham@codesourcery.com> * cp-tree.h: Fix typos in comments. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 11cb640..7e2124f 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3850,7 +3850,7 @@ convert_like_real (convs, expr, fn, argnum, inner) tree ref_type = totype; /* If necessary, create a temporary. */ - if (NEED_TEMPORARY_P (convs)) + if (NEED_TEMPORARY_P (convs) || !lvalue_p (expr)) { tree type = TREE_TYPE (TREE_OPERAND (convs, 0)); expr = build_target_expr_with_type (expr, type); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 09576be..3d93933 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2001-02-16 Jakub Jelinek <jakub@redhat.com> + + * g++.old-deja/g++.other/init16.C: Update the test so that it does + not need <string> and also tests the initialization at runtime. + 2001-02-16 Neil Booth <neil@daikokuya.demon.co.uk> * gcc.c-torture/execute/longlong.c: New test. diff --git a/gcc/testsuite/g++.old-deja/g++.other/init16.C b/gcc/testsuite/g++.old-deja/g++.other/init16.C index 8d7c1af..83d5a4e 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/init16.C +++ b/gcc/testsuite/g++.old-deja/g++.other/init16.C @@ -1,11 +1,28 @@ -// Build don't link: // Origin: Jakub Jelinek <jakub@redhat.com> -// excess errors test - XFAIL *-*-* - -#include <string> +struct bar { + char c; + bar (const char *); + bar (const bar &); +}; struct foo { - string x; + bar x; }; + extern const struct foo y = { "foo" }; + +bar::bar (const bar &ref) +{ + c = ref.c; +} + +bar::bar (const char *p) +{ + c = p[2]; +} + +int main () +{ + return y.x.c != 'o'; +} |