make_args_non_dependent (*args);
}
+ user_args = args == NULL ? NULL : *args;
+ /* Under DR 147 A::A() is an invalid constructor call,
+ not a functional cast. */
+ if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn))
+ {
+ if (! (complain & tf_error))
+ return error_mark_node;
+
+ permerror (input_location,
+ "cannot call constructor %<%T::%D%> directly",
+ basetype, name);
+ inform (input_location, "for a function-style cast, remove the "
+ "redundant %<::%D%>", name);
+ call = build_functional_cast (basetype, build_tree_list_vec (user_args),
+ complain);
+ release_tree_vector (user_args);
+ return call;
+ }
+
/* Figure out whether to skip the first argument for the error
message we will display to users if an error occurs. We don't
want to display any compiler-generated arguments. The "this"
pointer if this is a call to a base-class constructor or
destructor. */
skip_first_for_error = false;
- user_args = args == NULL ? NULL : *args;
if (IDENTIFIER_CTOR_OR_DTOR_P (name))
{
/* Callers should explicitly indicate whether they want to construct
namespace N1 {
-struct A { A(); };
+struct A { A(); void f(); };
struct B: public A { B(); };
A::A() { }
B::A ba;
A::A a; // { dg-error "constructor" "the injected-class-name can never be found through qualified lookup" }
+void A::f()
+{
+ A::A(); // { dg-message "::A" "c++/42415" }
+}
+
void f()
{
A::A a; // { dg-error "constructor" }
-} // { dg-error "" "" { target *-*-* } 18 } error cascade
+} // { dg-error "" "" { target *-*-* } 23 } error cascade
}
namespace N2 {