re PR c++/61647 (internal compiler error: in push_access_scope, at cp/pt.c:219 for...
authorJason Merrill <jason@redhat.com>
Mon, 30 Jun 2014 19:09:57 +0000 (15:09 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 30 Jun 2014 19:09:57 +0000 (15:09 -0400)
PR c++/61647
* pt.c (type_dependent_expression_p): Check BASELINK_OPTYPE.

From-SVN: r212168

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/template/conv14.C [new file with mode: 0644]

index 122cf8ada59380403bb04408f77b7417952ab9fe..dba9c551bacfc8f2b64a5fc816de89355c233c56 100644 (file)
@@ -1,5 +1,8 @@
 2014-06-30  Jason Merrill  <jason@redhat.com>
 
+       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.
 
index 70a946c09c6371283572d014ba4383434a503d25..355b63e50f1ca3c986786a0a78275e204c908329 100644 (file)
@@ -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 (file)
index 0000000..509ae6a
--- /dev/null
@@ -0,0 +1,30 @@
+// PR c++/61647
+
+class XX;
+
+template<typename Container, typename Key>
+struct Accessor;
+
+template<typename Container, typename Key, typename KeyStore = Key>
+class Variant {
+protected:
+    KeyStore index;
+    Container state;
+public:
+    Variant(Container st, const Key& i) : index(i), state(st) {}
+
+    template<typename T>
+    operator T() const {
+        return Accessor<Container, KeyStore>::template get<T>(state, index);
+    }
+};
+
+class AutoCleanVariant : public Variant<XX*, int> {
+public:
+    AutoCleanVariant(XX* st, int i) : Variant<XX*,int>(st,i) {}
+
+    template<typename T>
+    operator T() const {
+         return Variant<XX*, int>::operator T();
+    }
+};