public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18276] New: template classes that are friends of template classes
@ 2004-11-02 17:04 gcc-bugzilla at gcc dot gnu dot org
  2004-11-02 17:10 ` [Bug c++/18276] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-11-02 17:04 UTC (permalink / raw)
  To: gcc-bugs



I am not positive about this bug report, but I cannot see what G++
wants from me, and in addition all the other compilers I have access
to accept the following code (including 3.4).

----------------------------------------
template < template<typename> class Traits_ >
struct Factory
{
};

template < template<typename> class Traits_>
struct Product
{
  template < template<typename> class >
  friend class Factory;
};

template<typename Tag_>
struct traits {};

int
main ()
{
  Product<traits> ();
}
----------------------------------------

% g++-3.4 -Wall temp2.cc
% g++-snapshot -Wall temp2.cc
temp2.cc: In instantiation of `Product<traits>':
temp2.cc:19:   instantiated from here
temp2.cc:1: erreur: template parameter 'template<class> class Traits_'
temp2.cc:8: erreur: redeclared here as 'template<template<class> class Traits_> template<class> class<template-parameter-1-1>'
% icc -Wall temp2.cc
%

I do not understand the prototype g++ reports.  It looks as if it
concatenated the outer template to the inner friend template class.

Environment:
System: Linux nostromo 2.4.27-1-k7-smp #1 SMP Fri Sep 3 06:31:15 UTC 2004 i686 GNU/Linux
Architecture: i686

	
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,objc,ada --prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --enable-nls --enable-threads=posix --without-included-gettext --disable-werror --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk i486-linux-gnu

How-To-Repeat:

See above.
------- Additional Comments From akim at epita dot fr  2004-11-02 17:03 -------
Fix:

No idea :)

Unless my code is wrong, but I fail to see the clause in the standard.

-- 
           Summary: template classes that are friends of template classes
           Product: gcc
           Version: 0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: akim at epita dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/18276] [4.0 Regression] template classes that are friends of template classes
  2004-11-02 17:04 [Bug c++/18276] New: template classes that are friends of template classes gcc-bugzilla at gcc dot gnu dot org
@ 2004-11-02 17:10 ` pinskia at gcc dot gnu dot org
  2004-11-02 17:11 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-02 17:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-02 17:10 -------
Confirmed, the error is wrong.
here is the reduced testcase:
template <  template<typename> class >
struct Factory { };
template < template<typename> class >
struct Product
{
  template <  template<typename> class >
  friend class Factory;
};
template<typename Tag_>
struct traits {};
Product<traits> a;

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2004-11-02 17:10:36
               date|                            |
            Summary|template classes that are   |[4.0 Regression] template
                   |friends of template classes |classes that are friends of
                   |                            |template classes
   Target Milestone|---                         |4.0.0
            Version|0.0                         |4.0.0


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/18276] [4.0 Regression] template classes that are friends of template classes
  2004-11-02 17:04 [Bug c++/18276] New: template classes that are friends of template classes gcc-bugzilla at gcc dot gnu dot org
  2004-11-02 17:10 ` [Bug c++/18276] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-11-02 17:11 ` pinskia at gcc dot gnu dot org
  2004-11-02 17:48 ` reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-02 17:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-02 17:11 -------
: Search converges between 2004-08-25-trunk (#524) and 2004-08-26-trunk (#525).

-- 


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/18276] [4.0 Regression] template classes that are friends of template classes
  2004-11-02 17:04 [Bug c++/18276] New: template classes that are friends of template classes gcc-bugzilla at gcc dot gnu dot org
  2004-11-02 17:10 ` [Bug c++/18276] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2004-11-02 17:11 ` pinskia at gcc dot gnu dot org
@ 2004-11-02 17:48 ` reichelt at gcc dot gnu dot org
  2004-11-03  5:18 ` giovannibajo at libero dot it
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-02 17:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-11-02 17:48 -------
Even simpler testcase:

====================================================
template<template<int> class> struct A;

template<int> struct B
{
    template<template<int> class> friend class A;
};

B<0> b;
====================================================


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
           Keywords|                            |monitored


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/18276] [4.0 Regression] template classes that are friends of template classes
  2004-11-02 17:04 [Bug c++/18276] New: template classes that are friends of template classes gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-11-02 17:48 ` reichelt at gcc dot gnu dot org
@ 2004-11-03  5:18 ` giovannibajo at libero dot it
  2004-11-07 15:30 ` lerdsuwa at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2004-11-03  5:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-11-03 05:18 -------
Introduced by:

2004-08-25  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	PR c++/14428
	* pt.c (redeclare_class_template): Check the type of non-type and
	template template parameter.

http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?
cvsroot=gcc&r1=1.914&r2=1.915

We cannot use same_type_p to check redeclarations of template template 
parameter, as the one in the friend declaration as one more level of template 
nesting. This check was added for redeclaration of non-types template 
parameters, so I believe that catching only that case is enough.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lerdsuwa at gcc dot gnu dot
                   |                            |org


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/18276] [4.0 Regression] template classes that are friends of template classes
  2004-11-02 17:04 [Bug c++/18276] New: template classes that are friends of template classes gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-11-03  5:18 ` giovannibajo at libero dot it
@ 2004-11-07 15:30 ` lerdsuwa at gcc dot gnu dot org
  2004-11-09 16:01 ` lerdsuwa at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-07 15:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-11-07 15:30 -------
There is actually a tsubst_template_parms call before 
redeclare_class_template.  So the extra template level of 
friend should be removed.  I think it's a latent bug
in somewhere in tsubst_* codes for template template parameter.

-- 


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/18276] [4.0 Regression] template classes that are friends of template classes
  2004-11-02 17:04 [Bug c++/18276] New: template classes that are friends of template classes gcc-bugzilla at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-11-07 15:30 ` lerdsuwa at gcc dot gnu dot org
@ 2004-11-09 16:01 ` lerdsuwa at gcc dot gnu dot org
  2004-11-12 16:58 ` lerdsuwa at gcc dot gnu dot org
  2004-12-02 12:04 ` lerdsuwa at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-09 16:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-11-09 16:00 -------
Taking care of it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |lerdsuwa at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/18276] [4.0 Regression] template classes that are friends of template classes
  2004-11-02 17:04 [Bug c++/18276] New: template classes that are friends of template classes gcc-bugzilla at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-11-09 16:01 ` lerdsuwa at gcc dot gnu dot org
@ 2004-11-12 16:58 ` lerdsuwa at gcc dot gnu dot org
  2004-12-02 12:04 ` lerdsuwa at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-12 16:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-11-12 16:57 -------
Patch submitted:
  http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00971.html


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/18276] [4.0 Regression] template classes that are friends of template classes
  2004-11-02 17:04 [Bug c++/18276] New: template classes that are friends of template classes gcc-bugzilla at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-11-12 16:58 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-02 12:04 ` lerdsuwa at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-02 12:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-12-02 12:04 -------
Fixed in the mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-12-02 12:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-02 17:04 [Bug c++/18276] New: template classes that are friends of template classes gcc-bugzilla at gcc dot gnu dot org
2004-11-02 17:10 ` [Bug c++/18276] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-11-02 17:11 ` pinskia at gcc dot gnu dot org
2004-11-02 17:48 ` reichelt at gcc dot gnu dot org
2004-11-03  5:18 ` giovannibajo at libero dot it
2004-11-07 15:30 ` lerdsuwa at gcc dot gnu dot org
2004-11-09 16:01 ` lerdsuwa at gcc dot gnu dot org
2004-11-12 16:58 ` lerdsuwa at gcc dot gnu dot org
2004-12-02 12:04 ` lerdsuwa at gcc dot gnu dot org

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).