[llvm-bugs] [Bug 39047] New: Incorrect "use 'template' keyword to treat 'xxx' as a dependent template name" inside of virtual member functions of template classes
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Sep 22 03:38:52 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39047
Bug ID: 39047
Summary: Incorrect "use 'template' keyword to treat 'xxx' as a
dependent template name" inside of virtual member
functions of template classes
Product: clang
Version: 7.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: duncan.horn at utexas.edu
CC: llvm-bugs at lists.llvm.org
E.g. the following code fails to compile:
template <typename T>
struct special_ptr
{
T* ptr;
template <typename U>
special_ptr<U> as()
{
special_ptr<U> result;
result.ptr = reinterpret_cast<U*>(this->ptr);
return result;
}
};
template <typename T>
struct thing
{
special_ptr<int> intPtr;
virtual void do_something()
{
auto charPtr = this->intPtr.as<char>();
}
};
struct empty {};
int main()
{
thing<empty> t;
}
You can also view it at https://godbolt.org/z/ywb5CS. Note that GCC does not
have a problem with it. If you change 'thing' to no longer be a class template
_or_ if you make 'do_something' no longer virtual, it compiles fine.
--
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/20180922/74624f33/attachment.html>
More information about the llvm-bugs
mailing list