summaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 3e11a741fa5..7a8719153cb 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3552,6 +3552,12 @@ 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)