Commit 1ac8104c by Volker Reichelt Committed by Volker Reichelt

re PR c++/27804 (ICE with invalid const variable)

	PR c++/27804
	* init.c (constant_value_1): Return decl instead of error_mark_node
	for invalid initializers.

	PR c++/27804
	* g++.dg/init/const4.C: New test.
	* g++.dg/init/member1.C: Add error-marker.
	* g++.dg/other/fold1.C: Adjust error-marker.

From-SVN: r114377
parent 30f87202
2006-06-05 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27804
* init.c (constant_value_1): Return decl instead of error_mark_node
for invalid initializers.
2006-06-01 Andrew Pinski <pinskia@physics.uc.edu> 2006-06-01 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/27592 PR c++/27592
......
...@@ -1483,7 +1483,7 @@ constant_value_1 (tree decl, bool integral_p) ...@@ -1483,7 +1483,7 @@ constant_value_1 (tree decl, bool integral_p)
init = DECL_INITIAL (decl); init = DECL_INITIAL (decl);
} }
if (init == error_mark_node) if (init == error_mark_node)
return error_mark_node; return decl;
if (!init if (!init
|| !TREE_TYPE (init) || !TREE_TYPE (init)
|| (integral_p || (integral_p
......
2006-06-05 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27804
* g++.dg/init/const4.C: New test.
* g++.dg/init/member1.C: Add error-marker.
* g++.dg/other/fold1.C: Adjust error-marker.
2006-06-04 Volker Reichelt <reichelt@igpm.rwth-aachen.de> 2006-06-04 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27601 PR c++/27601
// PR c++/27804
// { dg-do compile }
bool foo()
{
const int i = X; // { dg-error "not declared" }
return i > 0;
}
...@@ -11,7 +11,7 @@ template<int> struct B {}; ...@@ -11,7 +11,7 @@ template<int> struct B {};
template<typename T> struct C template<typename T> struct C
{ {
static const int i = A<T>::i; // { dg-error "incomplete" } static const int i = A<T>::i; // { dg-error "incomplete" }
static const int j = i; static const int j = i; // { dg-error "non-constant expression" }
B<j> b; // { dg-error "not a valid template arg" } B<j> b; // { dg-error "not a valid template arg" }
}; };
......
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
struct A struct A
{ {
static const int i = i; // { dg-error "not declared" } static const int i = i; // { dg-error "not declared" }
int x[i]; // { dg-error "variable-size array" } int x[i]; // { dg-error "integral constant-expression" }
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment