/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 28 Oct 2011 18:40:22 +0000 (18:40 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 28 Oct 2011 18:40:22 +0000 (18:40 +0000)
2011-10-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/50864
* pt.c (tsubst_copy_and_build): Fix qualified_name_lookup_error
call in case COMPONENT_REF.

/testsuite
2011-10-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/50864
* g++.dg/template/crash109.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180623 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 9791ab5..14723f0 100644 (file)
@@ -1,3 +1,9 @@
+2011-10-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/50864
+       * pt.c (tsubst_copy_and_build): Fix qualified_name_lookup_error
+       call in case COMPONENT_REF.
+
 2011-10-27  Jason Merrill  <jason@redhat.com>
 
        * semantics.c (cxx_eval_outermost_constant_expr): Check
index 7aea72d..dc63366 100644 (file)
@@ -13741,14 +13741,12 @@ tsubst_copy_and_build (tree t,
        else if (TREE_CODE (member) == SCOPE_REF
                 && TREE_CODE (TREE_OPERAND (member, 1)) == TEMPLATE_ID_EXPR)
          {
-           tree tmpl;
-           tree args;
-
            /* Lookup the template functions now that we know what the
               scope is.  */
-           tmpl = TREE_OPERAND (TREE_OPERAND (member, 1), 0);
-           args = TREE_OPERAND (TREE_OPERAND (member, 1), 1);
-           member = lookup_qualified_name (TREE_OPERAND (member, 0), tmpl,
+           tree scope = TREE_OPERAND (member, 0);
+           tree tmpl = TREE_OPERAND (TREE_OPERAND (member, 1), 0);
+           tree args = TREE_OPERAND (TREE_OPERAND (member, 1), 1);
+           member = lookup_qualified_name (scope, tmpl,
                                            /*is_type_p=*/false,
                                            /*complain=*/false);
            if (BASELINK_P (member))
@@ -13762,7 +13760,7 @@ tsubst_copy_and_build (tree t,
              }
            else
              {
-               qualified_name_lookup_error (object_type, tmpl, member,
+               qualified_name_lookup_error (scope, tmpl, member,
                                             input_location);
                return error_mark_node;
              }
index f2f1c58..6937815 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/50864
+       * g++.dg/template/crash109.C: New.
+
 2011-10-28  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        * gfortran.dg/nearest_5.f90: New test.
diff --git a/gcc/testsuite/g++.dg/template/crash109.C b/gcc/testsuite/g++.dg/template/crash109.C
new file mode 100644 (file)
index 0000000..3f2f81e
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/50864
+
+namespace impl
+{
+  template <class T> T create();
+}
+
+template <class T, class U, __SIZE_TYPE__
+         = sizeof(impl::create<T>() -> impl::create<U>())>  // { dg-error "not a member" } 
+struct foo;