From: Reid Kleckner Date: Wed, 7 Mar 2018 23:26:02 +0000 (+0000) Subject: [MS] Accept __unaligned as a qualifier on member function pointers X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd8a50c0304d0a7fda8d99edbee8a7622d552092;p=clang [MS] Accept __unaligned as a qualifier on member function pointers We need to treat __unaligned like the other 'cvr' qualifiers when it appears at the end of a function prototype. We weren't doing that in some tentative parsing. Fixes PR36638. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326962 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp index 88c0e176b0..ebd6f0f5b8 100644 --- a/lib/Parse/ParseTentative.cpp +++ b/lib/Parse/ParseTentative.cpp @@ -1894,7 +1894,8 @@ Parser::TPResult Parser::TryParseFunctionDeclarator() { return TPResult::Error; // cv-qualifier-seq - while (Tok.isOneOf(tok::kw_const, tok::kw_volatile, tok::kw_restrict)) + while (Tok.isOneOf(tok::kw_const, tok::kw_volatile, tok::kw___unaligned, + tok::kw_restrict)) ConsumeToken(); // ref-qualifier[opt] diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp index 21635f0ee1..8799f49df6 100644 --- a/test/Parser/MicrosoftExtensions.cpp +++ b/test/Parser/MicrosoftExtensions.cpp @@ -424,3 +424,10 @@ struct S { S(T); } f([] {}); } + +namespace pr36638 { +// Make sure we accept __unaligned method qualifiers on member function +// pointers. +struct A; +void (A::*mp1)(int) __unaligned; +}