+2009-01-10 Andrew Pinski <pinskia@gmail.com>
+
+ PR c++/36695
+ * typeck2.c (build_functional_cast): Check for reference type and NULL
+ PARMS.
+
2009-01-09 Steve Ellcey <sje@cup.hp.com>
* typeck.c (cp_build_unary_op): Check for ERROR_MARK.
else
type = exp;
+ if (TREE_CODE (type) == REFERENCE_TYPE && !parms)
+ {
+ error ("invalid value-initialization of reference types");
+ return error_mark_node;
+ }
+
if (processing_template_decl)
{
tree t = build_min (CAST_EXPR, type, parms);
+2009-01-10 Andrew Pinski <pinskia@gmail.com>
+
+ PR c++/36695
+ * g++.dg/ext/complex4.C: New test.
+ * g++.dg/ext/complex5.C: New test.
+ * g++.dg/init/reference1.C: New test.
+ * g++.dg/init/reference2.C: New test.
+ * g++.dg/init/reference3.C: New test.
+
2009-01-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38763
--- /dev/null
+// { dg-do compile }
+// This code used to be rejected as there was no conversion from int to float __complex__
+ #include <vector>
+ typedef float __complex__ fcomplex;
+ std::vector<fcomplex> vfc(10);
--- /dev/null
+/* PR c++/21210 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef float __complex__ fcomplex;
+fcomplex cplx = fcomplex(0);
--- /dev/null
+// { dg-do compile }
+// This code used to be accepted but it is invalid as there is no
+// value initialization of a reference type.
+// PR c++/36695
+
+int main()
+{
+ typedef int& T;
+ T a = T(); // { dg-error "value-initialization of reference" }
+}
+
--- /dev/null
+// { dg-do compile }
+// This code used to be accepted but it is invalid as there is no
+// value initialization of a reference type.
+// PR c++/36695
+
+// We should we able to diagnostic this without instantiating the template
+template <int a1>
+int f()
+{
+ typedef int& T;
+ T a = T(); // { dg-error "value-initialization of reference" }
+}
+
--- /dev/null
+// { dg-do compile }
+// This code used to be accepted but it is invalid as there is no
+// value initialization of a reference type.
+// PR c++/36695
+
+template <typename T>
+T f()
+{
+ T a = T(); // { dg-error "value-initialization of reference" }
+}
+
+int &a = f<int&>(); // { dg-message "instantiated from here" }
+