re PR c++/49395 (Non-class prvalues seem to have cv-qualification with GCC)

PR c++/49395
	* init.c (build_zero_init_1): Strip cv-quals from scalar types.

From-SVN: r175339
This commit is contained in:
Jason Merrill 2011-06-23 12:52:41 -04:00 committed by Jason Merrill
parent d708df29c8
commit ece620047b
4 changed files with 19 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2011-06-23 Jason Merrill <jason@redhat.com>
PR c++/49395
* init.c (build_zero_init_1): Strip cv-quals from scalar types.
PR c++/36435
* pt.c (most_specialized_instantiation): Do check return types.

View File

@ -176,7 +176,7 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p,
initialized are initialized to zero. */
;
else if (SCALAR_TYPE_P (type))
init = convert (type, integer_zero_node);
init = convert (cv_unqualified (type), integer_zero_node);
else if (CLASS_TYPE_P (type))
{
tree field;

View File

@ -1,5 +1,8 @@
2011-06-23 Jason Merrill <jason@redhat.com>
PR c++/49395
* g++.dg/init/ref18.C: New.
PR c++/36435
* g++.dg/template/partial9.C: New.

View File

@ -0,0 +1,12 @@
// PR c++/49395
volatile int foo();
struct A { volatile int i; };
typedef volatile int vi;
volatile int i;
const int& ir1 = foo();
//const int& ir2 = A().i; // line 8
const int& ir3 = static_cast<volatile int>(i);
const int& ir4 = vi(); // line 10