From: jason Date: Wed, 24 Jun 2015 19:59:28 +0000 (+0000) Subject: PR c++/66647 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa4f365b8559743b59ae52801d74b7dbd4da4fce;p=thirdparty%2Fgcc.git PR c++/66647 * pt.c (dependent_type_p_r): Check for dependent alias template specialization sooner. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224917 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2fa1732f7794..9dc92669cedc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2015-06-24 Jason Merrill + PR c++/66647 + * pt.c (dependent_type_p_r): Check for dependent alias template + specialization sooner. + PR c++/66501 * class.c (type_has_nontrivial_assignment): Remove. * cp-tree.h: Remove declaration. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 8800af819ec7..b63c0d4b7dbb 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20992,6 +20992,12 @@ dependent_type_p_r (tree type) names a dependent type. */ if (TREE_CODE (type) == TYPENAME_TYPE) return true; + + /* An alias template specialization can be dependent even if the + resulting type is not. */ + if (dependent_alias_template_spec_p (type)) + return true; + /* -- a cv-qualified type where the cv-unqualified type is dependent. No code is necessary for this bullet; the code below handles @@ -21043,10 +21049,6 @@ dependent_type_p_r (tree type) && (any_dependent_template_arguments_p (INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (type))))) return true; - /* For an alias template specialization, check the arguments both to the - class template and the alias template. */ - else if (dependent_alias_template_spec_p (type)) - return true; /* All TYPEOF_TYPEs, DECLTYPE_TYPEs, and UNDERLYING_TYPEs are dependent; if the argument of the `typeof' expression is not diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-49.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-49.C new file mode 100644 index 000000000000..5fd3b650386a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-49.C @@ -0,0 +1,54 @@ +// PR c++/66647 +// { dg-do compile { target c++11 } } + +template struct A +{ + static constexpr _Tp value = 1; +}; +template class B +{ +public: + template struct rebind + { + }; +}; + +template class C +{ + template + static A _S_chk (typename _Alloc2::template rebind<_Tp2> *); + +public: + using __type = decltype (_S_chk<_Alloc, _Tp> (0)); +}; + +template ::__type::value> +struct D; +template struct D<_Alloc, _Tp, 1> +{ + typedef typename _Alloc::template rebind<_Tp> __type; +}; +template struct F +{ + template using rebind_alloc = typename D<_Alloc, _Tp>::__type; +}; +template struct __alloc_traits +{ + template struct rebind + { + typedef typename F<_Alloc>::template rebind_alloc other; + }; +}; +template struct G +{ + typename __alloc_traits<_Alloc>::template rebind::other _Tp_alloc_type; +}; +template > class vector : G<_Alloc> +{ +}; + +template using tfuncptr = void(); +template struct H +{ + vector > funcs; +};