re PR c++/48656 ([C++0x] cannot call member function without object)
authorDodji Seketeli <dodji@redhat.com>
Thu, 28 Apr 2011 18:08:43 +0000 (18:08 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Thu, 28 Apr 2011 18:08:43 +0000 (20:08 +0200)
Fix PR c++/48656

gcc/cp/

* semantics.c (finish_call_expr): Don't forget BASELINK nodes when
considering call expressions involving a member function.

gcc/testsuite/

* gcc/testsuite/g++.dg/template/inherit7.C: New test case.

From-SVN: r173123

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

index 163bee3c1a0b002ba6878742dc39a7d34450840b..6b6d81bd26e8782b1e40a0c266a9683c0dc2bf79 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-28  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/48656
+       * semantics.c (finish_call_expr): Don't forget BASELINK nodes when
+       considering call expressions involving a member function.
+
 2011-04-28  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/48530
index c6364120fe52ae6ce7b3e7f8cdfc469fa8902cc2..722e57fe528309aa0920d4e6ab3994b804ad8bdf 100644 (file)
@@ -2039,7 +2039,8 @@ finish_call_expr (tree fn, VEC(tree,gc) **args, bool disallow_virtual,
             is not included in *ARGS even though it is considered to
             be part of the list of arguments.  Note that this is
             related to CWG issues 515 and 1005.  */
-         || ((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
+         || (((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
+              || BASELINK_P (fn))
              && current_class_ref
              && type_dependent_expression_p (current_class_ref)))
        {
index 7f3804b98cb8f5968cc943b3890ebec7373af769..b0d5e1c6f6c6aa4ed1b3b18d57cffad7f4ba5a66 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-28  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/48656
+       * g++.dg/template/inherit7.C: New test case.
+
 2011-04-28  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/40052
diff --git a/gcc/testsuite/g++.dg/template/inherit7.C b/gcc/testsuite/g++.dg/template/inherit7.C
new file mode 100644 (file)
index 0000000..67afbca
--- /dev/null
@@ -0,0 +1,21 @@
+// Origin: PR c++/48656
+// { dg-options "-std=c++0x" }
+// { dg-do compile }
+
+struct A {
+ int f();
+ int f(int);
+};
+
+template <typename> struct B : A
+{
+};
+
+template <typename T> struct C : B<T>
+{
+    void
+    g()
+    {
+        A::f();
+    }
+};