public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41723] New: Error when using a qualified name to declare a nested template instantiation as a friend of the containing template
@ 2009-10-15 23:01 evaned at gmail dot com
2009-10-15 23:10 ` [Bug c++/41723] " evaned at gmail dot com
2009-10-16 11:43 ` redi at gcc dot gnu dot org
0 siblings, 2 replies; 4+ messages in thread
From: evaned at gmail dot com @ 2009-10-15 23:01 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2032 bytes --]
The following code complies with GCC 4.3.0-2 and presumably older versions
(also tested with 3.4), but fails under GCC 4.4.0:
template<typename T>
class C {
template <typename U> class D {};
friend class C::D<int>;
};
The message it outputs is:
$ /s/gcc-4.4.0/bin/g++ test.cc
test.cc:5: error: typename C<T>::D names template<class T> template<class
U> class C<T>::D, which is not a type
Here is compiler information (though it also failed under what IIRC is a Mingw
build of 4.5 experimental so I doubt this matters):
$ /s/gcc-4.4.0/bin/g++ -v
Reading specs from /../lib/gcc/i686-pc-linux-gnu/4.4.0/specs
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.4.0/configure --prefix=/s/gcc-4.4.0/i386_rhel5
--enable-shared --enable-threads --with-pic --enable-languages=c,c++,fortran
--with-gmp=/s/gmp-4.3.0/ --with-mpfr=/s/mpfr-2.4.1/
--with-mpfr-include=/s/mpfr-2.4.1/include --with-mpfr-lib=/s/mpfr-2.4.1/lib
Thread model: posix
gcc version 4.4.0 (GCC)
Things that allow the example to compile:
1. Remove the qualification (change 'C::D<int>' to just 'D<int>')
2. Make D not a template
3. Make C not a template
I can't say definitively that this is a bug and not just a change within an
ambiguity of the C++ standard (or even fixing a bug that used to permit illegal
code), but older versions of GCC, Intel CC 11, and Comeau's "try it out" online
thing all accept that snippet. However, it does have an easy fix, so even
though I encountered this issue in production code, it's not a big deal.
--
Summary: Error when using a qualified name to declare a nested
template instantiation as a friend of the containing
template
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: evaned at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41723
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <bug-41723-4@http.gcc.gnu.org/bugzilla/>]
end of thread, other threads:[~2015-03-27 18:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-15 23:01 [Bug c++/41723] New: Error when using a qualified name to declare a nested template instantiation as a friend of the containing template evaned at gmail dot com
2009-10-15 23:10 ` [Bug c++/41723] " evaned at gmail dot com
2009-10-16 11:43 ` redi at gcc dot gnu dot org
[not found] <bug-41723-4@http.gcc.gnu.org/bugzilla/>
2015-03-27 18:16 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).