From: Jason Merrill Date: Tue, 29 Mar 2011 18:47:56 +0000 (-0400) Subject: re PR c++/48319 ([C++0x] Segmentation fault in instantiation of std::is_constructible... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5b9e705e63f09c873cd19b7e79a0b7019d13f1ac;p=gcc.git re PR c++/48319 ([C++0x] Segmentation fault in instantiation of std::is_constructible) PR c++/48319 * pt.c (value_dependent_expression_p): Handle TEMPLATE_ID_EXPR. From-SVN: r171689 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3d0c02a44fa..c4df48dd746 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-03-29 Jason Merrill + PR c++/48319 + * pt.c (value_dependent_expression_p): Handle TEMPLATE_ID_EXPR. + PR c++/48089 * semantics.c (potential_constant_expression_1): Change error about use of *this in constructor into sorry. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index dfc726a005a..aa0901be3be 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18218,6 +18218,11 @@ value_dependent_expression_p (tree expression) return false; } + case TEMPLATE_ID_EXPR: + /* If a TEMPLATE_ID_EXPR involves a dependent name, it will be + type-dependent. */ + return type_dependent_expression_p (expression); + default: /* A constant expression is value-dependent if any subexpression is value-dependent. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fbd21e5d3a4..95157981e25 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-03-29 Jason Merrill + * g++.dg/cpp0x/dependent1.C: New. + * g++.dg/cpp0x/constexpr-48089.C: Adjust. * g++.dg/cpp0x/constexpr-memfn1.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/dependent1.C b/gcc/testsuite/g++.dg/cpp0x/dependent1.C new file mode 100644 index 00000000000..1ceeeafd78d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/dependent1.C @@ -0,0 +1,25 @@ +// PR c++/48319 +// { dg-options -std=c++0x } +// We were failing to recognize declval<_Args1> as dependent. + +template Tp declval() noexcept; + +template +class __is_constructible_helper +{ + typedef char __one; + typedef struct { char __arr[2]; } __two; + + template + static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int); + + template + static __two __test(...); + +public: + static const bool __value = sizeof(__test<_Tp>(0)) == 1; +}; + +int main() { + return __is_constructible_helper::__value; +}