diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-02 21:28:50 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-02 21:28:50 +0000 |
commit | a3c702a80e830b96f975e31df31cd560f97ac8eb (patch) | |
tree | 10dca596efc248e2d42da67bbf26853432593ca3 /gcc | |
parent | 0cc06088adc97d6ca9e66489d8a23397fa86f80c (diff) | |
download | gcc-a3c702a80e830b96f975e31df31cd560f97ac8eb.tar.gz |
PR c++/23840
* tree.c (lvalue_p1): A VA_ARG_EXPR with class type is an lvalue,
when class rvalues are lvalues.
PR c++/23840
* g++.dg/expr/stdarg1.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104877 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/tree.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/expr/stdarg1.C | 13 |
4 files changed, 29 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f4255d628cd..14fc98fbbea 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-10-02 Mark Mitchell <mark@codesourcery.com> + + PR c++/23840 + * tree.c (lvalue_p1): A VA_ARG_EXPR with class type is an lvalue, + when class rvalues are lvalues. + 2005-09-28 Mark Mitchell <mark@codesourcery.com> PR c++/16782 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 9c28f13f306..954a8093a95 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -158,8 +158,12 @@ lvalue_p_1 (tree ref, case TARGET_EXPR: return treat_class_rvalues_as_lvalues ? clk_class : clk_none; - case CALL_EXPR: case VA_ARG_EXPR: + return (treat_class_rvalues_as_lvalues + && CLASS_TYPE_P (TREE_TYPE (ref)) + ? clk_class : clk_none); + + case CALL_EXPR: /* Any class-valued call would be wrapped in a TARGET_EXPR. */ return clk_none; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 98bfad4bc91..67105b000d1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-02 Mark Mitchell <mark@codesourcery.com> + + PR c++/23840 + * g++.dg/expr/stdarg1.C: New test. + 2005-10-02 Diego Novillo <dnovillo@redhat.com> PR 24142 diff --git a/gcc/testsuite/g++.dg/expr/stdarg1.C b/gcc/testsuite/g++.dg/expr/stdarg1.C new file mode 100644 index 00000000000..85b6f7460e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/stdarg1.C @@ -0,0 +1,13 @@ +// PR c++/23840 + +#include <stdarg.h> +struct S +{ + int f(int); +}; +void f(int i, ...) +{ + va_list ap; + va_start (ap, i); + va_arg (ap, S).f(0); +} |