+2015-04-20 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Reject trailing return type for an operator auto().
+ * decl.c (grokdeclarator): Reject trailing return types for
+ all conversion operators, don't handle conversion operators
+ in the previous checks that deal with auto.
+
2015-04-20 Ilya Verbin <ilya.verbin@intel.com>
* parser.c (cp_parser_omp_target_update): Add missed %> to error_at ().
virtualp = false;
}
}
- else if (!is_auto (type))
+ else if (!is_auto (type) && sfk != sfk_conversion)
{
error ("%qs function with trailing return type has"
" %qT as its type rather than plain %<auto%>",
return error_mark_node;
}
}
- else if (declarator->u.function.late_return_type)
+ else if (declarator->u.function.late_return_type
+ && sfk != sfk_conversion)
{
if (cxx_dialect < cxx11)
/* Not using maybe_warn_cpp0x because this should
maybe_warn_cpp0x (CPP0X_EXPLICIT_CONVERSION);
explicitp = 2;
}
+ if (late_return_type_p)
+ error ("a conversion function cannot have a trailing return type");
}
arg_types = grokparms (declarator->u.function.parameters,
struct A2
{
- operator auto () -> int; // { dg-error "invalid use of" "" { target { ! c++14 } } }
- operator auto *() -> int; // { dg-error "auto" }
+ operator auto () -> int; // { dg-error "invalid use of|trailing return type" }
+ operator auto*() -> int; // { dg-error "invalid use of|trailing return type" }
};
template <typename> struct B