Access to private types in a class from another instantiated template class is
not getting the expected "type is private" error from gcc compiler.

$gcc -c -v inp4.cpp
Using built-in specs.
Target: hppa1.1-hp-hpux11.11
Configured with: /tmp/gcc-4.3.1.tar.gz/gcc-4.3.1/configure
--host=hppa1.1-hp-hpux11.11 --target=hppa1.1-hp-hpux11.11
--build=hppa1.1-hp-hpux11.11 --prefix=/opt/hp-gcc-4.3.1 --with-gnu-as
--without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-threads=posix
--enable-languages=c,c++ --with-gmp=/proj/opensrc/be/hppa1.1-hp-hpux11.11
--with-mpfr=/proj/opensrc/be/hppa1.1-hp-hpux11.11
Thread model: posix
gcc version 4.3.1 (GCC)
COLLECT_GCC_OPTIONS='-c' '-v' '-mschedule=7100LC'
 /usr/local/libexec/gcc/hppa1.1-hp-hpux11.11/4.3.1/cc1plus -quiet -v -iprefix
/usr/local/bin/../lib/gcc/hppa1.1-hp-hpux11.11/4.3.1/ inp4.cpp -quiet -dumpbase
inp4.cpp -mschedule=7100LC -auxbase inp4 -version -o /var/tmp//cc7ckWOk.s
ignoring nonexistent directory
"/usr/local/bin/../lib/gcc/hppa1.1-hp-hpux11.11/4.3.1/../../../../hppa1.1-hp-hpux11.11/include"
ignoring duplicate directory "/usr/local/include/c++/4.3.1"
ignoring duplicate directory
"/usr/local/include/c++/4.3.1/hppa1.1-hp-hpux11.11"
ignoring duplicate directory "/usr/local/include/c++/4.3.1/backward"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory
"/usr/local/lib/gcc/hppa1.1-hp-hpux11.11/4.3.1/include"
ignoring duplicate directory
"/usr/local/lib/gcc/hppa1.1-hp-hpux11.11/4.3.1/include-fixed"
ignoring nonexistent directory "/usr/local/hppa1.1-hp-hpux11.11/include"
#include "..." search starts here:
#include <...> search starts here:

/usr/local/bin/../lib/gcc/hppa1.1-hp-hpux11.11/4.3.1/../../../../include/c++/4.3.1

/usr/local/bin/../lib/gcc/hppa1.1-hp-hpux11.11/4.3.1/../../../../include/c++/4.3.1/hppa1.1-hp-hpux11.11

/usr/local/bin/../lib/gcc/hppa1.1-hp-hpux11.11/4.3.1/../../../../include/c++/4.3.1/backward
 /usr/local/bin/../lib/gcc/hppa1.1-hp-hpux11.11/4.3.1/include
 /usr/local/bin/../lib/gcc/hppa1.1-hp-hpux11.11/4.3.1/include-fixed
 /usr/local/include
 /usr/include
End of search list.
GNU C++ (GCC) version 4.3.1 (hppa1.1-hp-hpux11.11)
        compiled by GNU C version 4.3.1, GMP version 4.2.1, MPFR version 2.3.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d046d88028b4361d28297b29c4e5d08d
inp4.cpp:1: error: 'typedef int A::type' is private
inp4.cpp:6: error: within this context

$cat inp4.cpp
class A { typedef int type; };

template<typename T> class B { typedef A::type type; /* no error. */ };
B<void> b;

class C { typedef A::type type; /* error thrown. */ };

Note: Though I tested this with 4.3.1 gcc I think the problem should be present
in 4.4.0 as well because the changes document does not state anything related
to this bu.

Please get back as quicly as possible.


-- 
           Summary: no error for a instantiated class accessing  private
                    types in base class
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kannanmj at hp dot com
 GCC build triplet: hppa1.1-hp-hpux11.11
  GCC host triplet: hppa1.1-hp-hpux11.11
GCC target triplet: hppa1.1-hp-hpux11.11


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39956

Reply via email to