I have the following:
template class test;
typedef test testClass;
typedef testClass& refTestClass;
template class test
{
public:
test(refTestClass other);
private:
int member;
};
template
inline test::test(refTestClass other) {
member = other.member;
}
C:\Sony\Clang\exp>clang -cc1 priv.cpp
priv.cpp:15:17: error: ‘member’ is a private member of ‘test’
member = other.member;
^
priv.cpp:10:6: note: declared private here
int member;
Is this a bug or legitimate behavior?
Sorry to bug you with these. Basically I’m running Clang over a very large program written by someone else and compiled with gcc. Is this the appropriate place for this, or should I just file bugs and let someone else respond as needed?
-John
I have the following:
template <class TYPE> class test;
typedef test<int> testClass;
typedef testClass& refTestClass;
template <typename TYPE> class test
{
public:
test(refTestClass other);
private:
int member;
};
template <typename TYPE>
inline test<TYPE>::test(refTestClass other) {
member = other.member;
}
C:\Sony\Clang\exp>clang -cc1 priv.cpp
priv.cpp:15:17: error: 'member' is a private member of 'test<int>'
member = other.member;
^
priv.cpp:10:6: note: declared private here
int member;
Is this a bug or legitimate behavior?
It's a bug. There is one valid instantiation of this template, at TYPE=int, so we can't diagnose.
The bug has nothing to do with typedefs. Reduction:
template <class T> class A {
int foo;
int getFoo(A<int> &a) {
return a.foo;
}
};
Sorry to bug you with these. Basically I'm running Clang over a very large program written by someone else and compiled with gcc. Is this the appropriate place for this, or should I just file bugs and let someone else respond as needed?
Bugs are probably more appropriate. Please file this one.
John.