+1998-07-16 Mark Mitchell <mark@markmitchell.com>
+
+ * semantics.c (finish_object_call_expr): Move test for the
+ function called being a TYPE_DECL to ...
+ * call.c (build_new_method_call): Here.
+
1998-07-15 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (arg_assoc_class): Also look at template arguments, if any.
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)
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)
- {
- 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
}
--- /dev/null
+// Build don't link:
+
+struct IsCompressed { };
+struct Field {
+ bool IsCompressed() const { return true; }
+};
+
+template<class C>
+inline bool
+for_each(const Field& p, IsCompressed, C)
+{
+ return p.IsCompressed();
+}
--- /dev/null
+// Build don't link:
+
+struct IsCompressed { };
+struct Field {
+};
+
+template<class C>
+inline bool
+for_each(const Field& p, IsCompressed, C)
+{
+ return p.IsCompressed(); // ERROR - calling type like a method
+}
+
+template bool for_each<int>(const Field& p, IsCompressed, int); // ERROR - instantiated from here