]> granicus.if.org Git - clang/commitdiff
[MS] Accept __unaligned as a qualifier on member function pointers
authorReid Kleckner <rnk@google.com>
Wed, 7 Mar 2018 23:26:02 +0000 (23:26 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 7 Mar 2018 23:26:02 +0000 (23:26 +0000)
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

lib/Parse/ParseTentative.cpp
test/Parser/MicrosoftExtensions.cpp

index 88c0e176b02e8b1da1e8c6a3eec1f7af94384838..ebd6f0f5b8e22ab59a9d583105877253d96939dd 100644 (file)
@@ -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]
index 21635f0ee12f7b1cc4750ce57309dc7d6cdadd9a..8799f49df6c4596a95b420e6594741833f6b8058 100644 (file)
@@ -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;
+}