]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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 18:44:24 +0000 (14:44 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 30 Jun 2014 18:44:24 +0000 (14:44 -0400)
PR c++/61647
* pt.c (type_dependent_expression_p): Check BASELINK_OPTYPE.

From-SVN: r212163

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

index d67a63e15a985ba740d8c3c5e23568ef70089af8..48084942cd71fe5f56cfd7ec69dd931bdf449097 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++/61539
        * pt.c (unify_one_argument): Type/expression mismatch just causes
        deduction failure.
index 3ddd4b8a1f1f06510cb009f82e165dae7fd1bd13..a1888921a2fa61420063010aef2e6aeeb9d0664c 100644 (file)
@@ -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 (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();
+    }
+};