diff options
author | Jason Merrill <jason@redhat.com> | 2017-02-16 11:42:00 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-02-16 11:42:00 -0500 |
commit | 61cee2603036c29761a49c07a6531561ca507ddc (patch) | |
tree | 3ec635fb30d77f1855e85f44a2ceb9694d7069ae | |
parent | 31927af6c7cdfafde7243584166b49ca2968a32d (diff) | |
download | gcc-61cee2603036c29761a49c07a6531561ca507ddc.zip gcc-61cee2603036c29761a49c07a6531561ca507ddc.tar.gz gcc-61cee2603036c29761a49c07a6531561ca507ddc.tar.bz2 |
PR c++/79050 - ICE with undeduced auto and LTO
* decl.c (poplevel): Remove undeduced auto decls.
From-SVN: r245510
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lto/pr79050_0.C | 7 |
3 files changed, 17 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b48a6f2..2e94fee 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-02-16 Jason Merrill <jason@redhat.com> + + PR c++/79050 - ICE with undeduced auto and LTO + * decl.c (poplevel): Remove undeduced auto decls. + 2017-02-16 Jakub Jelinek <jakub@redhat.com> PR c++/79512 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 353e7b5..70c44fb 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -792,14 +792,17 @@ poplevel (int keep, int reverse, int functionbody) back ends won't understand OVERLOAD, so we remove them here. Because the BLOCK_VARS are (temporarily) shared with CURRENT_BINDING_LEVEL->NAMES we must do this fixup after we have - popped all the bindings. */ + popped all the bindings. Also remove undeduced 'auto' decls, + which LTO doesn't understand, and can't have been used by anything. */ if (block) { tree* d; for (d = &BLOCK_VARS (block); *d; ) { - if (TREE_CODE (*d) == TREE_LIST) + if (TREE_CODE (*d) == TREE_LIST + || (!processing_template_decl + && undeduced_auto_decl (*d))) *d = TREE_CHAIN (*d); else d = &DECL_CHAIN (*d); diff --git a/gcc/testsuite/g++.dg/lto/pr79050_0.C b/gcc/testsuite/g++.dg/lto/pr79050_0.C new file mode 100644 index 0000000..1f31b5d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr79050_0.C @@ -0,0 +1,7 @@ +// PR c++/79050 +// { dg-lto-do assemble } + +int main () +{ + auto foo (); +} |