From fef7e16b3fecef48e0ce67b9c0ab8fd32356e789 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sun, 6 Oct 2013 14:43:07 +0000 Subject: [PATCH] re PR c++/56060 (ICE on invalid code in type_dependent_expression_p, at cp/pt.c:19742) /cp 2013-10-06 Paolo Carlini PR c++/56060 * pt.c (type_dependent_expression_p): Handle EXPR_PACK_EXPANSION. /testsuite 2013-10-06 Paolo Carlini PR c++/56060 * g++.dg/cpp0x/variadic144.C: New. From-SVN: r203229 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/variadic144.C | 15 +++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic144.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 219f4154831..6f6d8368116 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-10-06 Paolo Carlini + + PR c++/56060 + * pt.c (type_dependent_expression_p): Handle EXPR_PACK_EXPANSION. + 2013-10-04 Paolo Carlini PR c++/58560 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 59be037c82e..2828cc983b3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20403,6 +20403,10 @@ type_dependent_expression_p (tree expression) if (TREE_CODE (expression) == SCOPE_REF) return false; + /* Always dependent, on the number of arguments if nothing else. */ + if (TREE_CODE (expression) == EXPR_PACK_EXPANSION) + return true; + if (BASELINK_P (expression)) expression = BASELINK_FUNCTIONS (expression); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 20ffa47e90a..bc867655d7d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-06 Paolo Carlini + + PR c++/56060 + * g++.dg/cpp0x/variadic144.C: New. + 2013-10-04 Paolo Carlini PR c++/58560 diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic144.C b/gcc/testsuite/g++.dg/cpp0x/variadic144.C new file mode 100644 index 00000000000..5d05d3d52bd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic144.C @@ -0,0 +1,15 @@ +// PR c++/56060 +// { dg-do compile { target c++11 } } + +template struct baz { }; +template T bar(); + +template +baz()(bar ...))> // { dg-error "cannot be used" } +foo(); + +int main() +{ + foo(); // { dg-error "no matching" } + return 0; +}