re PR c++/48212 ([C++0x] ICE: in non_const_var_error, at cp/semantics.c:6700 on invalid code)
PR c++/48212 * semantics.c (non_const_var_error): Just return if DECL_INITIAL is error_mark_node. From-SVN: r171748
This commit is contained in:
parent
e0f89433aa
commit
ef5daa257f
4 changed files with 20 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-03-30 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/48212
|
||||
* semantics.c (non_const_var_error): Just return if DECL_INITIAL
|
||||
is error_mark_node.
|
||||
|
||||
2011-03-30 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/48369
|
||||
|
|
|
@ -6753,6 +6753,9 @@ non_const_var_error (tree r)
|
|||
tree type = TREE_TYPE (r);
|
||||
error ("the value of %qD is not usable in a constant "
|
||||
"expression", r);
|
||||
/* Avoid error cascade. */
|
||||
if (DECL_INITIAL (r) == error_mark_node)
|
||||
return;
|
||||
if (DECL_DECLARED_CONSTEXPR_P (r))
|
||||
inform (DECL_SOURCE_LOCATION (r),
|
||||
"%qD used in its own initializer", r);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
2011-03-30 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* g++.dg/cpp0x/regress/error-recovery1.C: New.
|
||||
|
||||
* g++.dg/cpp0x/regress/isnan.C: New.
|
||||
|
||||
* g++.dg/cpp0x/initlist46.C: New.
|
||||
|
|
9
gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C
Normal file
9
gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C
Normal file
|
@ -0,0 +1,9 @@
|
|||
// PR c++/48212
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
template < bool > void
|
||||
foo ()
|
||||
{
|
||||
const bool b =; // { dg-error "" }
|
||||
foo < b > (); // { dg-error "constant expression" }
|
||||
};
|
Loading…
Add table
Reference in a new issue