[LLVMbugs] [Bug 15969] New: template base class members not accessible without this->
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat May 11 14:41:45 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=15969
Bug ID: 15969
Summary: template base class members not accessible without
this->
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: wschlanger at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
The following code compiles perfectly in Visual Studio. Amazingly, both
'clang++' and 'g++' complain about this line:
a = 1; // this does not work. why?
There's a chance Visual Studio is wrong and CLANG++/G++ are right.
Note that "this->a = 1;" does work.
--- code follows ---
template <class ValueType>
class base_t
{
public:
int a;
};
template <class ValueType, class DerivedType = ValueType>
class derived_t :
public base_t<ValueType>
{
public:
int foo()
{
a = 1; // this does not work. why?
this->a = 1; // this works
return 0;
}
};
int main(int argc, char *argv[])
{
derived_t<int> a;
a.foo();
return 0;
}
--
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/20130511/9d6b7b02/attachment.html>
More information about the llvm-bugs
mailing list