[PATCH] D29707: Fix improper microsoft-pure-definition warning on template class
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 21 06:12:33 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL358849: [Sema][MSVC] Fix bogus microsoft-pure-definition warning on member function of… (authored by brunoricci, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D29707?vs=87611&id=195999#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D29707/new/
https://reviews.llvm.org/D29707
Files:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -13244,7 +13244,7 @@
// 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()) {
Index: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
===================================================================
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp
@@ -288,6 +288,18 @@
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 at -1 2{{function definition with pure-specifier is a Microsoft extension}}
+};
+template struct pure_virtual_dtor_template_inline<int>;
+// expected-note at -1 {{in instantiation of member function}}
int main () {
// Necessary to force instantiation in -fdelayed-template-parsing mode.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29707.195999.patch
Type: text/x-patch
Size: 1672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190421/a5db7727/attachment.bin>
More information about the cfe-commits
mailing list