/* OK for C++11 lambdas. */;
else if (cxx_dialect < cxx14)
{
- error ("%qs function uses "
- "%<auto%> type specifier without trailing "
- "return type", name);
- inform (input_location, "deduced return type "
- "only available with -std=c++14 or "
- "-std=gnu++14");
+ error_at (typespec_loc, "%qs function uses "
+ "%<auto%> type specifier without "
+ "trailing return type", name);
+ inform (typespec_loc,
+ "deduced return type only available "
+ "with -std=c++14 or -std=gnu++14");
}
else if (virtualp)
{
- error ("virtual function cannot "
- "have deduced return type");
+ error_at (typespec_loc, "virtual function "
+ "cannot have deduced return type");
virtualp = false;
}
}
else if (!is_auto (type) && sfk != sfk_conversion)
{
- error ("%qs function with trailing return type has"
- " %qT as its type rather than plain %<auto%>",
- name, type);
+ error_at (typespec_loc, "%qs function with trailing "
+ "return type has %qT as its type rather "
+ "than plain %<auto%>", name, type);
return error_mark_node;
}
else if (is_auto (type) && AUTO_IS_DECLTYPE (type))
{
if (funcdecl_p)
- error ("%qs function with trailing return type has "
- "%<decltype(auto)%> as its type rather than "
- "plain %<auto%>", name);
+ error_at (typespec_loc,
+ "%qs function with trailing return type "
+ "has %<decltype(auto)%> as its type "
+ "rather than plain %<auto%>", name);
else
- error ("invalid use of %<decltype(auto)%>");
+ error_at (typespec_loc,
+ "invalid use of %<decltype(auto)%>");
return error_mark_node;
}
tree tmpl = CLASS_PLACEHOLDER_TEMPLATE (auto_node);
if (cxx_dialect < cxx11)
/* Not using maybe_warn_cpp0x because this should
always be an error. */
- error ("trailing return type only available with "
- "-std=c++11 or -std=gnu++11");
+ error_at (typespec_loc,
+ "trailing return type only available "
+ "with -std=c++11 or -std=gnu++11");
else
- error ("%qs function with trailing return type not "
- "declared with %<auto%> type specifier", name);
+ error_at (typespec_loc, "%qs function with trailing "
+ "return type not declared with %<auto%> "
+ "type specifier", name);
return error_mark_node;
}
}
// { dg-do compile { target c++11 } }
auto f1 () -> int;
-auto f2 (); // { dg-error "without trailing return type" "" { target { ! c++14 } } }
-int f3 () -> int; // { dg-error "trailing return type" }
-auto *f4 () -> int; // { dg-error "trailing return type" }
+auto f2 (); // { dg-error "1:.f2. function uses .auto. type specifier without trailing return type" "" { target { ! c++14 } } }
+int f3 () -> int; // { dg-error "1:.f3. function with trailing return type" }
+auto *f4 () -> int; // { dg-error "1:.f4. function with trailing return type" }
struct A
{
auto f5 () const -> int;
- auto f6 (); // { dg-error "without trailing return type" "" { target { ! c++14 } } }
- int f7 () -> int; // { dg-error "trailing return type" }
- auto *f8 () -> int; // { dg-error "trailing return type" }
+ auto f6 (); // { dg-error "3:.f6. function uses .auto. type specifier without trailing return type" "" { target { ! c++14 } } }
+ int f7 () -> int; // { dg-error "3:.f7. function with trailing return type" }
+ auto *f8 () -> int; // { dg-error "3:.f8. function with trailing return type" }
};