re PR c++/23840 (Bogus "invalid lvalue in unary '&'" diagnostic and ICE with va_arg)

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.

From-SVN: r104877
This commit is contained in:
Mark Mitchell 2005-10-02 21:28:50 +00:00 committed by Mark Mitchell
parent b19bb8b044
commit c0ad5a3173
4 changed files with 29 additions and 1 deletions

View File

@ -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> 2005-09-28 Mark Mitchell <mark@codesourcery.com>
PR c++/16782 PR c++/16782

View File

@ -158,8 +158,12 @@ lvalue_p_1 (tree ref,
case TARGET_EXPR: case TARGET_EXPR:
return treat_class_rvalues_as_lvalues ? clk_class : clk_none; return treat_class_rvalues_as_lvalues ? clk_class : clk_none;
case CALL_EXPR:
case VA_ARG_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. */ /* Any class-valued call would be wrapped in a TARGET_EXPR. */
return clk_none; return clk_none;

View File

@ -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> 2005-10-02 Diego Novillo <dnovillo@redhat.com>
PR 24142 PR 24142

View File

@ -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);
}