[cfe-dev] Accessing private members through typedefs

John Thompson john.thompson.jtsoftware at gmail.com
Fri Apr 30 18:49:46 PDT 2010

I have the following:

template <class TYPE> class test;
typedef test<int> testClass;
typedef testClass& refTestClass;
template <typename TYPE> class test
 test(refTestClass other);
 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?

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 Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100430/bdb057ae/attachment.html>

More information about the cfe-dev mailing list