<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Incorrect warning generation "function definition with pure-specifier is a Microsoft extension" with templated types"
href="http://llvm.org/bugs/show_bug.cgi?id=21334">21334</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect warning generation "function definition with pure-specifier is a Microsoft extension" with templated types
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sanders_roger@hotmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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:
<a href="http://llvm.org/builds/downloads/LLVM-3.6.0-r219740-win32.exe">http://llvm.org/builds/downloads/LLVM-3.6.0-r219740-win32.exe</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>