[Bug c++/38579] New: Template: Wrong inherited copy-ctor visibility
The code below compiles, but it should give an error, because the Policy ctor is not accessible when inheriting protected from Policy To have valid C++ code the inheritance must be public. struct Policy { protected: Policy() {} Policy(const Policy&) {} }; template struct BugGcc : protected P //public P { BugGcc() {} template BugGcc(const BugGcc& t) : P(t) {} }; void foo() { BugGcc<0, Policy> f1; BugGcc<1, Policy> f2(f1); } GCC: gcc-Version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC) -- Summary: Template: Wrong inherited copy-ctor visibility Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: syntheticpp at gmx dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
--- Comment #3 from syntheticpp at gmx dot net 2009-01-14 18:29 --- 11.2 is talking about a different case. When you instantiate the integer template parameter manually you will see that it is really a bug: struct Policy { protected: Policy() {} Policy(const Policy&) {} }; template struct BugGcc0 : protected P //public P { BugGcc0() {} }; template struct BugGcc1 : public P { BugGcc1() {} template BugGcc1(const BugGcc0& t) : P(t) {} }; void foo() { BugGcc0 d0; BugGcc1 d1(d0); } The Policy ctor is visible within BugGcc1 (because it is inherited protected) but it is not visible to a different class (again, because it is inherited protected). BugGcc0 and BugGcc1 only have the same base class but they are NOT of same type which 11.2 talks about. The protected policy ctor is only visible for BugGcc0 but not for BugGcc1. -- syntheticpp at gmx dot net changed: What|Removed |Added CC| |syntheticpp at gmx dot net Status|RESOLVED|REOPENED Resolution|INVALID | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
--- Comment #4 from syntheticpp at gmx dot net 2009-01-15 18:56 --- It has nothing to do with templates. This code still compiles: struct P { protected: P() {} P(const P&) {} }; struct B : protected P { B() {} }; struct C : public P { C(const B& b) : P(b) {} }; void foo() { B b; C c(b); //P p(b); // <-- compiler error } But I it should not, because only within the scope of B B "is a" P. Globally B "is not a" P. Therefore you can't pass a instance of B in a scope different to B to the constructor of P. Even when C inherits from P the struct B is still "not a" P in the scope of C. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[Bug c++/29486] New: call of friend template is ambiguous
While moving the definition of a friend template out of the class definition I found this error. Please compile the attached file and have a look at the ReleaseAll function. The file is part of Loki. -- Summary: call of friend template is ambiguous Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: syntheticpp at gmx dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29486
[Bug c++/29486] call of friend template is ambiguous
--- Comment #1 from syntheticpp at gmx dot net 2006-10-16 17:40 --- Created an attachment (id=12447) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12447&action=view) demo: g++ bug.cpp -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29486
[Bug c++/29486] call of friend template is ambiguous
--- Comment #3 from syntheticpp at gmx dot net 2006-10-16 20:53 --- Comeau compiles it, but vc8 also fails. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29486
[Bug c++/29486] call of friend template is ambiguous
--- Comment #4 from syntheticpp at gmx dot net 2006-10-16 20:59 --- Created an attachment (id=12448) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12448&action=view) mingw-gcc crash Here another file which does not compile. On Windows gcc even crashs: bug2.cpp: In function `void friend_handling()': bug2.cpp:1626: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See http://www.mingw.org/bugs.shtml> for instructions. Reading specs from c:/programme/mingw/bin/../lib/gcc/mingw32/3.4.5/specs Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/min gw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --ena ble-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-in terpreter --enable-hash-synchronization --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.5 (mingw special) And cygwin: Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/ usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=boehm --disable-win32 -registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstdcxx-debug : (reconfigured) Thread model: posix gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29486
[Bug c++/29486] call of friend template is ambiguous
--- Comment #5 from syntheticpp at gmx dot net 2006-10-16 21:09 --- bug2.cpp: 4.0.1 and 20061010 doesn't crash. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29486
[Bug c++/29486] call of friend template is ambiguous
--- Comment #6 from syntheticpp at gmx dot net 2006-10-16 21:18 --- (In reply to comment #2) > Quickly looking at the source, I think this is the same as PR 29438 and PR > 29236. > Yes, this is possible, allways template templates are used as template parameter. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29486