<html>
<head>
<base href="https://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 --- - Clang-CL fails to match types after resolving typedefs"
href="https://llvm.org/bugs/show_bug.cgi?id=31734">31734</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang-CL fails to match types after resolving typedefs
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>steveire@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I don't know which compiler is correct with this, but it's an incompatibilty I
found. When the Derived method is defined, the signature is different spelling
to the declaration, but the types are the same.
c:\dev\tmp>type main.cpp
template< typename T1>
struct Base
{
typedef int Param;
};
template< typename T1>
struct Derived : public Base< T1>
{
inline static void method(typename Base<T1>::Param param);
};
template<typename T1>
inline void Derived<T1>::method(typename Derived<T1>::Param param)
{
}
c:\dev\tmp>"C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\bin\x86_amd64\CL.exe" /c main.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
main.cpp
c:\dev\tmp>C:\dev\src\llvm\build\releaseprefix\msbuild-bin\CL.exe /c main.cpp
main.cpp(15,26): error: out-of-line definition of 'method' does not match any
declaration in 'Derived<T1>'
inline void Derived<T1>::method(typename Derived<T1>::Param param)
^~~~~~
1 error generated.
c:\dev\tmp>type main.cpp
template< typename T1>
struct Base
{
typedef int Param;
};
template< typename T1>
struct Derived : public Base< T1>
{
inline static typename Base<T1>::Param method();
};
template<typename T1>
inline typename Derived<T1>::Param Derived<T1>::method()
{
}
c:\dev\tmp>"C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\bin\x86_amd64\CL.exe" /c main.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
main.cpp
c:\dev\tmp>C:\dev\src\llvm\build\releaseprefix\msbuild-bin\CL.exe /c main.cpp
main.cpp(15,49): error: return type of out-of-line definition of
'Derived::method' differs from that in the declaration
inline typename Derived<T1>::Param Derived<T1>::method()
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp(11,44): note: previous declaration is here
inline static typename Base<T1>::Param method();
~~~~~~~~~~~~~~~~~~~~~~~~ ^
1 error generated.</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>