mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-21 15:50:50 +08:00
re PR c++/71516 (ICE on invalid C++ code (invalid use of forward declared type) on x86_64-linux-gnu: Segmentation fault (program cc1plus))
PR c++/71516 * decl.c (complete_vars): Handle gracefully type == error_mark_node. * g++.dg/init/pr71516.C: New test. From-SVN: r237445
This commit is contained in:
parent
acfadf066d
commit
abe7f8287e
@ -1,3 +1,8 @@
|
||||
2016-06-14 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/71516
|
||||
* decl.c (complete_vars): Handle gracefully type == error_mark_node.
|
||||
|
||||
2016-06-14 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* typeck2.c (digest_init_r): Use EXPR_LOC_OR_LOC on init.
|
||||
|
@ -15029,8 +15029,9 @@ complete_vars (tree type)
|
||||
tree var = iv->decl;
|
||||
tree type = TREE_TYPE (var);
|
||||
|
||||
if (TYPE_MAIN_VARIANT (strip_array_types (type))
|
||||
== iv->incomplete_type)
|
||||
if (type != error_mark_node
|
||||
&& (TYPE_MAIN_VARIANT (strip_array_types (type))
|
||||
== iv->incomplete_type))
|
||||
{
|
||||
/* Complete the type of the variable. The VAR_DECL itself
|
||||
will be laid out in expand_expr. */
|
||||
|
@ -1,3 +1,8 @@
|
||||
2016-06-14 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/71516
|
||||
* g++.dg/init/pr71516.C: New test.
|
||||
|
||||
2016-06-14 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* g++.dg/init/array46.C: New.
|
||||
|
10
gcc/testsuite/g++.dg/init/pr71516.C
Normal file
10
gcc/testsuite/g++.dg/init/pr71516.C
Normal file
@ -0,0 +1,10 @@
|
||||
// PR c++/71516
|
||||
// { dg-do compile }
|
||||
|
||||
struct A; // { dg-message "forward declaration of" }
|
||||
struct B
|
||||
{
|
||||
static A a;
|
||||
};
|
||||
A B::a = A(); // { dg-error "has initializer but incomplete type|invalid use of incomplete type" }
|
||||
struct A {};
|
Loading…
x
Reference in New Issue
Block a user