diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 7ebf06a04fa7..780d48958cb9 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -1119,7 +1119,7 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability, // Also reject wide string literals. if (StringLiteral *MessageStringLiteral = cast_or_null(MessageExpr.get())) { - if (MessageStringLiteral->getCharByteWidth() != 1) { + if (!MessageStringLiteral->isAscii()) { Diag(MessageStringLiteral->getSourceRange().getBegin(), diag::err_expected_string_literal) << /*Source='availability attribute'*/ 2; diff --git a/clang/test/Parser/attr-availability.c b/clang/test/Parser/attr-availability.c index d812296d9354..d3b640a2feea 100644 --- a/clang/test/Parser/attr-availability.c +++ b/clang/test/Parser/attr-availability.c @@ -22,6 +22,14 @@ void f7() __attribute__((availability(macosx,message=L"wide"))); // expected-err void f8() __attribute__((availability(macosx,message="a" L"b"))); // expected-error {{expected string literal for optional message in 'availability' attribute}} +void f9() __attribute__((availability(macosx,message=u8"b"))); // expected-error {{expected string literal for optional message in 'availability' attribute}} + +void f10() __attribute__((availability(macosx,message="a" u8"b"))); // expected-error {{expected string literal for optional message in 'availability' attribute}} + +void f11() __attribute__((availability(macosx,message=u"b"))); // expected-error {{expected string literal for optional message in 'availability' attribute}} + +void f12() __attribute__((availability(macosx,message="a" u"b"))); // expected-error {{expected string literal for optional message in 'availability' attribute}} + // rdar://10095131 enum E{ gorf __attribute__((availability(macosx,introduced=8.5, message = 10.0))), // expected-error {{expected string literal for optional message in 'availability' attribute}}