PR c++/49395
* init.c (build_zero_init_1): Strip cv-quals from scalar types.
From-SVN: r175339
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.
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;
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.
--- /dev/null
+// 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