From f36ae62867b1158b03b2ef7293a87cf9bec3cc14 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 30 Jun 2014 15:09:57 -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: r212168 --- 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 122cf8ada59..dba9c551bac 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++/61566 * mangle.c (decl_mangling_context): Look through a TEMPLATE_DECL. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 70a946c09c6..355b63e50f1 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -21089,7 +21089,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 00000000000..509ae6a6546 --- /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.30.2