diff options
author | Erich Keane <erich.keane@intel.com> | 2019-01-25 17:01:42 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2019-01-25 17:01:42 +0000 |
commit | 3e7fda229d3f82034f43c12bcb5c91f8ba08db94 (patch) | |
tree | 0f6c42c6e7d0d3dd263e2023305e5cb9263dfd83 /clang/lib/Sema/SemaDecl.cpp | |
parent | 0020f8bb23bc539bce640a479a73082ed2cb6036 (diff) | |
download | bcm5719-llvm-3e7fda229d3f82034f43c12bcb5c91f8ba08db94.tar.gz bcm5719-llvm-3e7fda229d3f82034f43c12bcb5c91f8ba08db94.zip |
Allow 'static' storage specifier on an out-of-line member function template
declaration in MSVCCompat mode
Microsoft compiler permits the use of 'static' storage specifier outside
of a class definition if it's on an out-of-line member function template
declaration.
This patch allows 'static' storage specifier on an out-of-line member
function template declaration with a warning in Clang (To be compatible
with Microsoft).
Intel C/C++ compiler allows the 'static' keyword with a warning in
Microsoft mode. GCC allows this with -fpermissive.
Patch By: Manna
Differential Revision: https://reviews.llvm.org/D56473
Change-Id: I97b2d9e9d57cecbcd545d17e2523142a85ca2702
llvm-svn: 352219
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 9f00a5ee2ac..4894b9ee30c 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -8625,8 +8625,12 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // Complain about the 'static' specifier if it's on an out-of-line // member function definition. + + // MSVC permits the use of a 'static' storage specifier on an out-of-line + // member function template declaration, warn about this. Diag(D.getDeclSpec().getStorageClassSpecLoc(), - diag::err_static_out_of_line) + NewFD->getDescribedFunctionTemplate() && getLangOpts().MSVCCompat + ? diag::ext_static_out_of_line : diag::err_static_out_of_line) << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc()); } |