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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs