diff options
author | Jason Merrill <jason@redhat.com> | 2014-06-03 07:56:58 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-06-03 07:56:58 -0400 |
commit | 616abc647c1fa14fabdbe708c4adcf88135916ef (patch) | |
tree | 7f6499e383aaa725cb6f8db30917be0aed42e538 /gcc/varpool.c | |
parent | b31e65bb600deccb25cdac88b8db1144066c307e (diff) | |
download | gcc-616abc647c1fa14fabdbe708c4adcf88135916ef.zip gcc-616abc647c1fa14fabdbe708c4adcf88135916ef.tar.gz gcc-616abc647c1fa14fabdbe708c4adcf88135916ef.tar.bz2 |
re PR c++/61020 (typeid(typeid(X)) produces 'ud2')
PR c++/61020
* varpool.c (ctor_for_folding): Handle uninitialized vtables.
From-SVN: r211178
Diffstat (limited to 'gcc/varpool.c')
-rw-r--r-- | gcc/varpool.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/varpool.c b/gcc/varpool.c index 1697bb4..143cd3b 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -306,7 +306,16 @@ ctor_for_folding (tree decl) if (DECL_VIRTUAL_P (real_decl)) { gcc_checking_assert (TREE_READONLY (real_decl)); - return DECL_INITIAL (real_decl); + if (DECL_INITIAL (real_decl)) + return DECL_INITIAL (real_decl); + else + { + /* The C++ front end creates VAR_DECLs for vtables of typeinfo + classes not defined in the current TU so that it can refer + to them from typeinfo objects. Avoid returning NULL_TREE. */ + gcc_checking_assert (!COMPLETE_TYPE_P (DECL_CONTEXT (real_decl))); + return error_mark_node; + } } /* If there is no constructor, we have nothing to do. */ |