aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-07-16 23:38:43 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-07-16 23:38:43 +0000
commitc68c56f7272a81e363a632eda204055d8c8c7319 (patch)
treefed587701549fb9eb8a3d48c3397855465c64b09 /gcc/cp
parentb5044593c9c5e815f5bbfd482ef0bb64396d90c9 (diff)
downloadgcc-c68c56f7272a81e363a632eda204055d8c8c7319.zip
gcc-c68c56f7272a81e363a632eda204055d8c8c7319.tar.gz
gcc-c68c56f7272a81e363a632eda204055d8c8c7319.tar.bz2
semantics.c (finish_object_call_expr): Revert previous change.
1998-07-16 Mark Mitchell <mark@markmitchell.com> * semantics.c (finish_object_call_expr): Revert previous change. * call.c (build_new_method_call): Likewise. Instead, convert TYPE_DECLs to IDENTIFIERs here, in the presence of templates. From-SVN: r21240
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c6
-rw-r--r--gcc/cp/semantics.c19
3 files changed, 25 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 20e6653..62d2753 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+1998-07-16 Mark Mitchell <mark@markmitchell.com>
+
+ * semantics.c (finish_object_call_expr): Revert previous change.
+ * call.c (build_new_method_call): Likewise. Instead, convert
+ TYPE_DECLs to IDENTIFIERs here, in the presence of templates.
+
1998-07-16 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (qualify_lookup): Handle templates.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 7a87191..3e11a74 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3552,12 +3552,6 @@ build_new_method_call (instance, name, args, basetype_path, flags)
template_only = 1;
}
- if (TREE_CODE (name) == TYPE_DECL)
- {
- cp_error ("calling type `%T' like a method", name);
- return error_mark_node;
- }
-
/* If there is an extra argument for controlling virtual bases,
remove it for error reporting. */
if (flags & LOOKUP_HAS_IN_CHARGE)
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index cae0b67..3459d1a 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -922,6 +922,25 @@ finish_object_call_expr (fn, object, args)
tree real_fn = build_component_ref (object, fn, NULL_TREE, 1);
return finish_call_expr (real_fn, args);
#else
+ if (TREE_CODE (fn) == TYPE_DECL)
+ {
+ if (processing_template_decl)
+ /* This can happen on code like:
+
+ class X;
+ template <class T> void f(T t) {
+ t.X();
+ }
+
+ We just grab the underlying IDENTIFIER. */
+ fn = DECL_NAME (fn);
+ else
+ {
+ cp_error ("calling type `%T' like a method", fn);
+ return error_mark_node;
+ }
+ }
+
return build_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
#endif
}