From e6517d3943ab2b51bd63ed37d6181e02b5461c86 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 30 Jun 2014 14:44:24 -0400 Subject: [PATCH] re PR c++/61647 (internal compiler error: in push_access_scope, at cp/pt.c:219 for a c++ header, clang++ 3.4 generate .pch without error) PR c++/61647 * pt.c (type_dependent_expression_p): Check BASELINK_OPTYPE. From-SVN: r212163 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 7 +++++- gcc/testsuite/g++.dg/template/conv14.C | 30 ++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/conv14.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d67a63e15a98..48084942cd71 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2014-06-30 Jason Merrill + PR c++/61647 + * pt.c (type_dependent_expression_p): Check BASELINK_OPTYPE. + PR c++/61539 * pt.c (unify_one_argument): Type/expression mismatch just causes deduction failure. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3ddd4b8a1f1f..a1888921a2fa 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20011,7 +20011,12 @@ type_dependent_expression_p (tree expression) return true; if (BASELINK_P (expression)) - expression = BASELINK_FUNCTIONS (expression); + { + if (BASELINK_OPTYPE (expression) + && dependent_type_p (BASELINK_OPTYPE (expression))) + return true; + expression = BASELINK_FUNCTIONS (expression); + } if (TREE_CODE (expression) == TEMPLATE_ID_EXPR) { diff --git a/gcc/testsuite/g++.dg/template/conv14.C b/gcc/testsuite/g++.dg/template/conv14.C new file mode 100644 index 000000000000..509ae6a65465 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/conv14.C @@ -0,0 +1,30 @@ +// PR c++/61647 + +class XX; + +template +struct Accessor; + +template +class Variant { +protected: + KeyStore index; + Container state; +public: + Variant(Container st, const Key& i) : index(i), state(st) {} + + template + operator T() const { + return Accessor::template get(state, index); + } +}; + +class AutoCleanVariant : public Variant { +public: + AutoCleanVariant(XX* st, int i) : Variant(st,i) {} + + template + operator T() const { + return Variant::operator T(); + } +}; -- 2.47.2