From 3e475d30a363db90039aec1239fcfc1a15e202aa Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 11 May 2011 17:29:35 -0400 Subject: [PATCH] re PR c++/48745 ([C++0x] Segmentation fault with list-initialization, void initializers and variadics) PR c++/48745 * pt.c (value_dependent_expr_p): Handle CONSTRUCTOR. From-SVN: r173678 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 10 ++++++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/sfinae22.C | 23 +++++++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae22.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6a27cbb36b8..fe1ccb57e48 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-05-11 Jason Merrill + + PR c++/48745 + * pt.c (value_dependent_expr_p): Handle CONSTRUCTOR. + 2011-05-11 Nathan Froyd * cp-tree.h (TYPENAME_TYPE_FULLNAME, TYPEOF_TYPE_EXPR): Use diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5e2497796fd..74d4cbf1edd 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18273,6 +18273,16 @@ value_dependent_expression_p (tree expression) type-dependent. */ return type_dependent_expression_p (expression); + case CONSTRUCTOR: + { + unsigned ix; + tree val; + FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (expression), ix, val) + if (value_dependent_expression_p (val)) + return true; + return false; + } + default: /* A constant expression is value-dependent if any subexpression is value-dependent. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 79919a2c5ce..51aacc5fddb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-05-11 Jason Merrill + + * g++.dg/cpp0x/sfinae22.C: New. + 2011-05-11 Tobias Burnus PR fortran/48889 diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae22.C b/gcc/testsuite/g++.dg/cpp0x/sfinae22.C new file mode 100644 index 00000000000..1c3efd2e079 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae22.C @@ -0,0 +1,23 @@ +// PR c++/48745 +// { dg-options -std=c++0x } + +template +struct add_rval_ref { + typedef T&& type; +}; + +template<> +struct add_rval_ref { + typedef void type; +}; + +template +typename add_rval_ref::type create(); + +template +decltype(T{create()...}, char()) f(int); + +template +char (&f(...))[2]; + +static_assert(sizeof(f(0)) != 1, "Error"); // # -- 2.30.2