Error with using declaration when templates involved (2.95.2).

Robert Dick dickrp@EE.Princeton.EDU
Sun Aug 6 19:53:00 GMT 2000


Version 2.95.2
SuSE 6.4 with kernel 2.2.16-SuSE-3

/*===========================================================================*/
Command line: 'gcc -v --save-temps main.cc'

/*===========================================================================*/
Output

Reading specs from /usr/lib/gcc-lib/i486-suse-linux/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/lib/gcc-lib/i486-suse-linux/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di486 -D__i486 -D__i486__ main.cc main.ii
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/local/include
 /usr/lib/gcc-lib/i486-suse-linux/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i486-suse-linux/2.95.2/../../../../i486-suse-linux/include
End of omitted list.
 /usr/lib/gcc-lib/i486-suse-linux/2.95.2/cc1plus main.ii -quiet -dumpbase main.cc -version -o main.s
GNU C++ version 2.95.2 19991024 (release) (i486-suse-linux) compiled by GNU C version 2.95.2 19991024 (release).
main.cc: In function `int main()':
main.cc:2: `void Parent::insert<int>(int)' is inaccessible
main.cc:11: within this context

/*===========================================================================*/
main.ii

# 1 "main.cc"
struct Parent {
        template <typename I> void insert(I p) {}
        void insert() {}
};

struct Child : private Parent { using Parent::insert; };

int main() {
        Child c;
        c.insert();  
        c.insert(2);  
        return 0;
}

/*===========================================================================*/
Problem:

To the best of my knowledge, 'c.insert(2)' should work fine, without any 'is
inaccessible' error.  This code works as expected when compiled with the
'MIPSpro Compilers: Version 7.30'.

I would appreciate a response indicating whether GCC's behavior is a bug.
Perhaps this is an area of ambiguity in the standard.

Thank you,

-Robert Dick-



More information about the Gcc-bugs mailing list