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: unassignedclangb...@nondot.org
Reporter: duncan.h...@utexas.edu
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs