diff options
| author | Bruno Ricci <riccibrun@gmail.com> | 2019-04-21 13:12:10 +0000 |
|---|---|---|
| committer | Bruno Ricci <riccibrun@gmail.com> | 2019-04-21 13:12:10 +0000 |
| commit | ba7ffae0c56474c9ddfe7bac4a06f8b98911ab08 (patch) | |
| tree | ba65f15e9c932f1dcea2d8f733bebeceb2e45e6c /clang/test/Parser | |
| parent | d50ec8ef5cf5395077669ee570b6c30ff7ed2511 (diff) | |
| download | bcm5719-llvm-ba7ffae0c56474c9ddfe7bac4a06f8b98911ab08.tar.gz bcm5719-llvm-ba7ffae0c56474c9ddfe7bac4a06f8b98911ab08.zip | |
[Sema][MSVC] Fix bogus microsoft-pure-definition warning on member function of class template
Clang emits a warning when using a pure specifier =0 in a function definition
at class scope (a MS-specific construct), when using -fms-extensions.
However, to detect this, it was using FD->isCanonicalDecl() on function
declaration, which was also detecting out-of-class definition of member
functions of class templates. Fix this by using !FD->isOutOfLine() instead.
Fixes PR21334.
Differential Revision: https://reviews.llvm.org/D29707
Reviewed By: riccibruno
Reviewers: rnk, riccibruno
Patch By: Rudy Pons
llvm-svn: 358849
Diffstat (limited to 'clang/test/Parser')
| -rw-r--r-- | clang/test/Parser/MicrosoftExtensions.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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. |

