[llvm-bugs] [Bug 31734] New: Clang-CL fails to match types after resolving typedefs
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 24 07:10:41 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31734
Bug ID: 31734
Summary: Clang-CL fails to match types after resolving typedefs
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Driver
Assignee: unassignedclangbugs at nondot.org
Reporter: steveire at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
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.
--
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/20170124/92e6bb09/attachment.html>
More information about the llvm-bugs
mailing list