* typeck.c (cp_build_modify_expr): Check for NULL current_function_decl.
* g++.dg/expr/string-1.C: New test.
* g++.dg/expr/string-2.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143245
138bc75d-0d04-0410-961f-
82ee72b054a4
2009-01-10 Andrew Pinski <pinskia@gmail.com>
+ PR c++/38648
+ * typeck.c (cp_build_modify_expr): Check for NULL current_function_decl.
+
PR c++/36695
* typeck2.c (build_functional_cast): Check for reference type and NULL
PARMS.
}
/* Allow array assignment in compiler-generated code. */
- if (! DECL_ARTIFICIAL (current_function_decl))
+ if (!current_function_decl || !DECL_ARTIFICIAL (current_function_decl))
{
/* This routine is used for both initialization and assignment.
Make sure the diagnostic message differentiates the context. */
2009-01-10 Andrew Pinski <pinskia@gmail.com>
+ PR c++/38648
+ * g++.dg/expr/string-1.C: New test.
+ * g++.dg/expr/string-2.C: New test.
+
PR c++/36695
* g++.dg/ext/complex4.C: New test.
* g++.dg/ext/complex5.C: New test.
--- /dev/null
+// { dg-do compile }
+// This testcase used to seg fault (PR c++/38648)
+
+char a[1];
+
+int foo( // { dg-error "extended initializer lists only available" }
+{
+ a = ""; // { dg-error "" }
+ return 0; // { dg-error "" }
+} // { dg-error "" }
--- /dev/null
+// { dg-do compile }
+// This testcase used to seg fault (PR c++/38648)
+
+char a[1];
+
+int foo(a = "") // { dg-error "invalid array assignment" }
+{ // { dg-error "" }
+ return 0;
+}
+