From: Jason Merrill Date: Fri, 6 Apr 2018 15:12:28 +0000 (-0400) Subject: PR c++/85240 - LTO ICE with using of undeduced auto fn. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0c923157ab1522e9d8b2fe8c3dabc6c5cbc35b1d;p=gcc.git PR c++/85240 - LTO ICE with using of undeduced auto fn. * cp-gimplify.c (cp_genericize_r): Discard using of undeduced auto. From-SVN: r259177 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 759e9c99e0d..71eceaaa31b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-04-06 Jason Merrill + + PR c++/85240 - LTO ICE with using of undeduced auto fn. + * cp-gimplify.c (cp_genericize_r): Discard using of undeduced auto. + 2018-04-05 Jakub Jelinek PR c++/85209 diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index fd0c37f9be2..fb0aea3e0c7 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1294,16 +1294,20 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) } if (block) { - tree using_directive; - gcc_assert (TREE_OPERAND (stmt, 0)); + tree decl = TREE_OPERAND (stmt, 0); + gcc_assert (decl); - using_directive = make_node (IMPORTED_DECL); - TREE_TYPE (using_directive) = void_type_node; + if (undeduced_auto_decl (decl)) + /* Omit from the GENERIC, the back-end can't handle it. */; + else + { + tree using_directive = make_node (IMPORTED_DECL); + TREE_TYPE (using_directive) = void_type_node; - IMPORTED_DECL_ASSOCIATED_DECL (using_directive) - = TREE_OPERAND (stmt, 0); - DECL_CHAIN (using_directive) = BLOCK_VARS (block); - BLOCK_VARS (block) = using_directive; + IMPORTED_DECL_ASSOCIATED_DECL (using_directive) = decl; + DECL_CHAIN (using_directive) = BLOCK_VARS (block); + BLOCK_VARS (block) = using_directive; + } } /* The USING_STMT won't appear in GENERIC. */ *stmt_p = build1 (NOP_EXPR, void_type_node, integer_zero_node); diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn51.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn51.C new file mode 100644 index 00000000000..7e4f488458b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn51.C @@ -0,0 +1,9 @@ +// PR c++/85240 +// { dg-do compile { target c++14 } } + +auto foo(); + +void bar() +{ + using ::foo; +}