summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
-rw-r--r--clang/test/Parser/MicrosoftExtensions.cpp12
2 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1c332674d2d..b6ddd860399 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -13244,7 +13244,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
// MSVC permits the use of pure specifier (=0) on function definition,
// defined at class scope, warn about this non-standard construct.
- if (getLangOpts().MicrosoftExt && FD->isPure() && FD->isCanonicalDecl())
+ if (getLangOpts().MicrosoftExt && FD->isPure() && !FD->isOutOfLine())
Diag(FD->getLocation(), diag::ext_pure_function_definition);
if (!FD->isInvalidDecl()) {
diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp
index 8799f49df6c..63e8b608239 100644
--- a/clang/test/Parser/MicrosoftExtensions.cpp
+++ b/clang/test/Parser/MicrosoftExtensions.cpp
@@ -288,6 +288,18 @@ struct pure_virtual_dtor_inline {
virtual ~pure_virtual_dtor_inline() = 0 { }// expected-warning {{function definition with pure-specifier is a Microsoft extension}}
};
+template<typename T> struct pure_virtual_dtor_template {
+ virtual ~pure_virtual_dtor_template() = 0;
+};
+template<typename T> pure_virtual_dtor_template<T>::~pure_virtual_dtor_template() {}
+template struct pure_virtual_dtor_template<int>;
+
+template<typename T> struct pure_virtual_dtor_template_inline {
+ virtual ~pure_virtual_dtor_template_inline() = 0 {}
+ // expected-warning@-1 2{{function definition with pure-specifier is a Microsoft extension}}
+};
+template struct pure_virtual_dtor_template_inline<int>;
+// expected-note@-1 {{in instantiation of member function}}
int main () {
// Necessary to force instantiation in -fdelayed-template-parsing mode.
OpenPOWER on IntegriCloud