From fd8a50c0304d0a7fda8d99edbee8a7622d552092 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 7 Mar 2018 23:26:02 +0000 Subject: [PATCH] [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 --- lib/Parse/ParseTentative.cpp | 3 ++- test/Parser/MicrosoftExtensions.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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; +} -- 2.50.1