def err_implied_std_coroutine_traits_not_found : Error<
"you need to include <coroutine> before defining a coroutine">;
def err_malformed_std_coroutine_traits : Error<
- "std::coroutine_traits must be a class template">;
+ "'std::coroutine_traits' must be a class template">;
def err_implied_std_coroutine_traits_promise_type_not_found : Error<
- "this function cannot be a coroutine: %0 has no member named 'promise_type'">;
+ "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
def err_implied_std_coroutine_traits_promise_type_not_class : Error<
"this function cannot be a coroutine: %0 is not a class">;
def err_coroutine_traits_missing_specialization : Error<
"this function cannot be a coroutine: missing definition of "
- "specialization %0">;
+ "specialization %q0">;
}
let CategoryName = "Documentation Issue" in {
// The promise type is required to be a class type.
QualType PromiseType = S.Context.getTypeDeclType(Promise);
if (!PromiseType->getAsCXXRecordDecl()) {
+ // Use the fully-qualified name of the type.
+ auto *NNS = NestedNameSpecifier::Create(S.Context, nullptr, Std);
+ NNS = NestedNameSpecifier::Create(S.Context, NNS, false,
+ CoroTrait.getTypePtr());
+ PromiseType = S.Context.getElaboratedType(ETK_None, NNS, PromiseType);
+
S.Diag(Loc, diag::err_implied_std_coroutine_traits_promise_type_not_class)
<< PromiseType;
return QualType();
template<typename ...T> struct std::coroutine_traits<int, T...> {};
int no_promise_type() {
- co_await a; // expected-error {{this function cannot be a coroutine: 'coroutine_traits<int>' has no member named 'promise_type'}}
+ co_await a; // expected-error {{this function cannot be a coroutine: 'std::coroutine_traits<int>' has no member named 'promise_type'}}
+}
+
+template<> struct std::coroutine_traits<double, double> { typedef int promise_type; };
+double bad_promise_type(double) {
+ co_await a; // expected-error {{this function cannot be a coroutine: 'std::coroutine_traits<double, double>::promise_type' (aka 'int') is not a class}}
}
struct promise; // expected-note {{forward declaration}}