mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/51461 ([c++0x] [4.7 Regression] ICE with invalid initialization of static data member)
PR c++/51461 * decl.c (check_static_variable_definition): Check COMPLETE_TYPE_P before literal_type_p. From-SVN: r182415
This commit is contained in:
parent
a8c1d89997
commit
10574a9f5c
|
@ -1,5 +1,9 @@
|
||||||
2011-12-16 Jason Merrill <jason@redhat.com>
|
2011-12-16 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/51461
|
||||||
|
* decl.c (check_static_variable_definition): Check COMPLETE_TYPE_P
|
||||||
|
before literal_type_p.
|
||||||
|
|
||||||
PR c++/51331
|
PR c++/51331
|
||||||
* class.c (convert_to_base_statically): Just call
|
* class.c (convert_to_base_statically): Just call
|
||||||
build_simple_base_path.
|
build_simple_base_path.
|
||||||
|
|
|
@ -5449,7 +5449,7 @@ check_initializer (tree decl, tree init, int flags, VEC(tree,gc) **cleanups)
|
||||||
}
|
}
|
||||||
else if (!COMPLETE_TYPE_P (type))
|
else if (!COMPLETE_TYPE_P (type))
|
||||||
{
|
{
|
||||||
error ("%qD has incomplete type", decl);
|
error ("%q#D has incomplete type", decl);
|
||||||
TREE_TYPE (decl) = error_mark_node;
|
TREE_TYPE (decl) = error_mark_node;
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
}
|
}
|
||||||
|
@ -7807,7 +7807,10 @@ check_static_variable_definition (tree decl, tree type)
|
||||||
return 0;
|
return 0;
|
||||||
else if (cxx_dialect >= cxx0x && !INTEGRAL_OR_ENUMERATION_TYPE_P (type))
|
else if (cxx_dialect >= cxx0x && !INTEGRAL_OR_ENUMERATION_TYPE_P (type))
|
||||||
{
|
{
|
||||||
if (literal_type_p (type))
|
if (!COMPLETE_TYPE_P (type))
|
||||||
|
error ("in-class initialization of static data member %q#D of "
|
||||||
|
"incomplete type", decl);
|
||||||
|
else if (literal_type_p (type))
|
||||||
permerror (input_location,
|
permerror (input_location,
|
||||||
"%<constexpr%> needed for in-class initialization of "
|
"%<constexpr%> needed for in-class initialization of "
|
||||||
"static data member %q#D of non-integral type", decl);
|
"static data member %q#D of non-integral type", decl);
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2011-12-16 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/51461
|
||||||
|
* g++.dg/init/static4.C: New.
|
||||||
|
|
||||||
2011-12-16 Jason Merrill <jason@redhat.com>
|
2011-12-16 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
PR c++/51331
|
PR c++/51331
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
// PR c++/51461
|
||||||
|
|
||||||
|
struct A
|
||||||
|
{
|
||||||
|
static const A a = 0; // { dg-error "incomplete|non-integral" }
|
||||||
|
};
|
Loading…
Reference in New Issue