[LLVMbugs] [Bug 21334] New: Incorrect warning generation "function definition with pure-specifier is a Microsoft extension" with templated types

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 21 17:41:58 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21334

            Bug ID: 21334
           Summary: Incorrect warning generation "function definition with
                    pure-specifier is a Microsoft extension" with
                    templated types
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sanders_roger at hotmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When compiling C++ code using Clang in Visual Studio, when a templated class
provides an implementation for a pure virtual function, clang generates the
following warning:
"function definition with pure-specifier is a Microsoft extension
[-Wmicrosoft]"
This warning is always generated, even when the function definition is provided
separately from the function declaration. Consider the following code:

template<class T>
class ISomeType
{
public:
    virtual ~ISomeType() = 0;
};
template<class T>
ISomeType<T>::~ISomeType() { }

template<class T>
class SomeType :public ISomeType<T>
{ };

int main()
{
    SomeType<int> someObject;
    return 0;
}

This is perfectly valid and standard C++ code. Despite this, Clang will
generate the following output from the compiler:
1>main.cpp(5,10): warning : function definition with pure-specifier is a
Microsoft extension [-Wmicrosoft]
1>          virtual ~ISomeType() = 0;
1>                  ^
1>  main.cpp(11,7) :  note: in instantiation of member function
'ISomeType<int>::~ISomeType' requested here
1>  class SomeType :public ISomeType<T>
1>        ^
1>  1 warning generated.

Making ISomeType a non-template type will make the warning disappear.

The development environment used is Windows 8.1 with Visual Studio 2013 Update
3, using the following distribution of Clang for Windows:
http://llvm.org/builds/downloads/LLVM-3.6.0-r219740-win32.exe

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141022/ff0850cd/attachment.html>


More information about the llvm-bugs mailing list