public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26912]  New: friend const member function specialization fails to compile
@ 2006-03-29  3:27 Thomas8675309 at yahoo dot com
  2006-03-29  9:32 ` [Bug c++/26912] [4.0/4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Thomas8675309 at yahoo dot com @ 2006-03-29  3:27 UTC (permalink / raw)
  To: gcc-bugs

The following code:

struct Foo { 
   template<class T> int func() const; 
}; 

class Bar { 
   friend int Foo::func<int>() const; // line 6 
}; 


gives the following error under gcc 4.1.0:

C:\djgpp>gcc -c z:\proj\gccerr.cpp

z:\proj\gccerr.cpp:6: error: template-id 'func<int>' for 'int 
Foo::func<int>()' does not match any template declaration 

C:\djgpp>gcc -v
Using built-in specs.
Target: djgpp
Configured with: /gnu/gcc-4.10/configure djgpp --prefix=/dev/env/DJDIR
--disable
-nls --disable-werror --enable-languages=c,c++,fortran,objc,obj-c++,ada
Thread model: single
gcc version 4.1.0

C:\djgpp>gcc -v -c z:\proj\gccerr.cpp
Using built-in specs.
Target: djgpp
Configured with: /gnu/gcc-4.10/configure djgpp --prefix=/dev/env/DJDIR
--disable
-nls --disable-werror --enable-languages=c,c++,fortran,objc,obj-c++,ada
Thread model: single
gcc version 4.1.0
 c:/djgpp/bin/../libexec/gcc/djgpp/4.10/cc1plus.exe -quiet -v -iprefix
c:/djgpp/
bin/../lib/gcc/djgpp/4.10/ -remap -imacros
c:/djgpp/bin/../lib/gcc/djgpp/4.10/dj
gpp.ver z:\proj\gccerr.cpp -quiet -dumpbase gccerr.cpp -mtune=pentium -auxbase
 gccerr -version -o c:/djgpp/tmp/cczwyr7J.s
ignoring nonexistent directory
"c:/djgpp/bin/../lib/gcc/djgpp/4.10/../../../../d
jgpp/include"
ignoring nonexistent directory "c:/djgpp/djgpp/include/"
#include "..." search starts here:
#include <...> search starts here:
 c:/djgpp/bin/../lib/gcc/djgpp/4.10/../../../../include/cxx/4.10
 c:/djgpp/bin/../lib/gcc/djgpp/4.10/../../../../include/cxx/4.10/djgpp
 c:/djgpp/bin/../lib/gcc/djgpp/4.10/../../../../include/cxx/4.10/backward
 c:/djgpp/bin/../lib/gcc/djgpp/4.10/include
 c:/djgpp/include/cxx/4.10/
 c:/djgpp/include/cxx/4.10/djgpp/
 c:/djgpp/include/cxx/4.10/backward/
 c:/djgpp/lib/gcc/djgpp/4.10/include/
 c:/djgpp/include/
End of search list.
GNU C++ version 4.1.0 (djgpp)
        compiled by GNU C version 4.1.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: a3a6c870906aa82e2d798a28b9e97cf3
z:\proj\gccerr.cpp:6: error: template-id 'func<int>' for 'int Foo::func<int>()
' does not match any template declaration


gcc 3.4.5 compiles the code without diagnostic, as does Comeau.

Both gcc 3.4.5 and gcc 4.1.0 compile the code cleanly if I change 
Foo::func to be non-const: 

struct Foo { 
   template<class T> int func(); 
}; 

class Bar { 
   friend int Foo::func<int>(); // line 6 
};


-- 
           Summary: friend const member function specialization fails to
                    compile
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas8675309 at yahoo dot com
 GCC build triplet: 4.1.0
  GCC host triplet: 4.1.0
GCC target triplet: 4.1.0


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


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

* [Bug c++/26912] [4.0/4.1/4.2 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
@ 2006-03-29  9:32 ` rguenth at gcc dot gnu dot org
  2006-04-16 19:11 ` mmitchel at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-03-29  9:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2006-03-29 09:32 -------
Confirmed.

struct Foo {
   template<class T> int func() ;
};

class Bar {
   friend int Foo::func<int>() const ; // line 6
};

is also invalidly accepted.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |accepts-invalid, rejects-
                   |                            |valid
      Known to fail|                            |3.3.5 4.0.3 4.1.0 4.2.0
      Known to work|                            |3.4.6
   Last reconfirmed|0000-00-00 00:00:00         |2006-03-29 09:32:16
               date|                            |
            Summary|friend const member function|[4.0/4.1/4.2 Regression]
                   |specialization fails to     |friend const member function
                   |compile                     |specialization fails to
                   |                            |compile
   Target Milestone|---                         |4.1.1


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


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

* [Bug c++/26912] [4.0/4.1/4.2 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
  2006-03-29  9:32 ` [Bug c++/26912] [4.0/4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
@ 2006-04-16 19:11 ` mmitchel at gcc dot gnu dot org
  2006-04-23 18:57 ` mmitchel at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-04-16 19:11 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug c++/26912] [4.0/4.1/4.2 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
  2006-03-29  9:32 ` [Bug c++/26912] [4.0/4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
  2006-04-16 19:11 ` mmitchel at gcc dot gnu dot org
@ 2006-04-23 18:57 ` mmitchel at gcc dot gnu dot org
  2006-04-24  3:50 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-04-23 18:57 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/26912] [4.0/4.1/4.2 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
                   ` (2 preceding siblings ...)
  2006-04-23 18:57 ` mmitchel at gcc dot gnu dot org
@ 2006-04-24  3:50 ` mmitchel at gcc dot gnu dot org
  2006-04-24  3:55 ` [Bug c++/26912] [4.0/4.1 " mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-04-24  3:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from mmitchel at gcc dot gnu dot org  2006-04-24 03:50 -------
Subject: Bug 26912

Author: mmitchel
Date: Mon Apr 24 03:50:31 2006
New Revision: 113213

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113213
Log:
        PR c++/26912
        * cp-tree.h (build_this_parm): Declare.
        (grok_method_quals): Remove.
        (build_memfn_type): Declare.
        (build_artificial_parm): Declare.
        (do_friend): Remove quals parameter.
        * decl.c (build_this_parm): New function.
        (grokfndecl): Use it.  Do not pass quals to grokclassfn.
        (grokdeclarator): Rename quals to memfn_quals.  Avoid allocating
        unnecessary TYPE_DECLs.  Correct qualification of member function
        types.  Tidy.
        * method.c (implicitly_declare_fn): Use build_this_parm.
        * friend.c (do_friend): Remove quals parameter.
        * decl2.c (grok_method_quals): Remove.
        (build_memfn_type): New function.
        (build_artificial_parm): Give it external linkage.
        (grokclassfn): Remove quals parameter.  Do not build "this"
        PARM_DECL here.
        PR c++/26912
        * g++.dg/template/friend41.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/friend41.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/friend.c
    trunk/gcc/cp/method.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/26912] [4.0/4.1 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
                   ` (3 preceding siblings ...)
  2006-04-24  3:50 ` mmitchel at gcc dot gnu dot org
@ 2006-04-24  3:55 ` mmitchel at gcc dot gnu dot org
  2006-05-01 15:11 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-04-24  3:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mmitchel at gcc dot gnu dot org  2006-04-24 03:55 -------
Fixed in 4.2.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0/4.1/4.2 Regression]    |[4.0/4.1 Regression] friend
                   |friend const member function|const member function
                   |specialization fails to     |specialization fails to
                   |compile                     |compile


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


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

* [Bug c++/26912] [4.0/4.1 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
                   ` (4 preceding siblings ...)
  2006-04-24  3:55 ` [Bug c++/26912] [4.0/4.1 " mmitchel at gcc dot gnu dot org
@ 2006-05-01 15:11 ` mmitchel at gcc dot gnu dot org
  2006-05-01 15:12 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-01 15:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mmitchel at gcc dot gnu dot org  2006-05-01 15:11 -------
Subject: Bug 26912

Author: mmitchel
Date: Mon May  1 15:11:34 2006
New Revision: 113415

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113415
Log:
        PR c++/26912
        * decl.c (grokdeclarator): Qualify "this" pointer when forming
        member function types.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/friend41.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/decl.c


-- 


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


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

* [Bug c++/26912] [4.0/4.1 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
                   ` (5 preceding siblings ...)
  2006-05-01 15:11 ` mmitchel at gcc dot gnu dot org
@ 2006-05-01 15:12 ` mmitchel at gcc dot gnu dot org
  2006-05-01 15:13 ` [Bug c++/26912] [4.0 " mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-01 15:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mmitchel at gcc dot gnu dot org  2006-05-01 15:12 -------
Subject: Bug 26912

Author: mmitchel
Date: Mon May  1 15:12:11 2006
New Revision: 113416

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113416
Log:
        PR c++/26912
        * g++.dg/template/friend41.C: New test.

Modified:
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/26912] [4.0 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
                   ` (6 preceding siblings ...)
  2006-05-01 15:12 ` mmitchel at gcc dot gnu dot org
@ 2006-05-01 15:13 ` mmitchel at gcc dot gnu dot org
  2006-05-25  2:34 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-01 15:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from mmitchel at gcc dot gnu dot org  2006-05-01 15:13 -------
Fixed in 4.1.1.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0/4.1 Regression] friend |[4.0 Regression] friend
                   |const member function       |const member function
                   |specialization fails to     |specialization fails to
                   |compile                     |compile


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


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

* [Bug c++/26912] [4.0 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
                   ` (7 preceding siblings ...)
  2006-05-01 15:13 ` [Bug c++/26912] [4.0 " mmitchel at gcc dot gnu dot org
@ 2006-05-25  2:34 ` mmitchel at gcc dot gnu dot org
  2006-05-25  3:39 ` fang at csl dot cornell dot edu
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-25  2:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from mmitchel at gcc dot gnu dot org  2006-05-25 02:31 -------
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.1                       |4.1.2


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


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

* [Bug c++/26912] [4.0 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
                   ` (8 preceding siblings ...)
  2006-05-25  2:34 ` mmitchel at gcc dot gnu dot org
@ 2006-05-25  3:39 ` fang at csl dot cornell dot edu
  2006-05-25 16:33 ` pinskia at gcc dot gnu dot org
  2007-02-03 16:26 ` gdr at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: fang at csl dot cornell dot edu @ 2006-05-25  3:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from fang at csl dot cornell dot edu  2006-05-25 03:39 -------
Subject: Re:  [4.0 Regression] friend const member function
 specialization fails to compile

> ------- Comment #7 from mmitchel at gcc dot gnu dot org  2006-05-25 02:31 -------
> Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.

Isn't this already fixed for 4.1?  (re-target 4.0.4?)


-- 


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


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

* [Bug c++/26912] [4.0 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
                   ` (9 preceding siblings ...)
  2006-05-25  3:39 ` fang at csl dot cornell dot edu
@ 2006-05-25 16:33 ` pinskia at gcc dot gnu dot org
  2007-02-03 16:26 ` gdr at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-25 16:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2006-05-25 16:33 -------
Actually this was fixed in 4.1.1 so changing the milestone again.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.3.5 4.0.3 4.1.0 4.2.0     |3.3.5 4.0.3 4.1.0
      Known to work|3.4.6                       |3.4.6 4.1.1 4.2.0
   Target Milestone|4.1.2                       |4.0.4


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


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

* [Bug c++/26912] [4.0 Regression] friend const member function specialization fails to compile
  2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
                   ` (10 preceding siblings ...)
  2006-05-25 16:33 ` pinskia at gcc dot gnu dot org
@ 2007-02-03 16:26 ` gdr at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 16:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from gdr at gcc dot gnu dot org  2007-02-03 16:26 -------
Fixed in GCC-4.1.1


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.0.4                       |4.1.1


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


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

end of thread, other threads:[~2007-02-03 16:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-29  3:27 [Bug c++/26912] New: friend const member function specialization fails to compile Thomas8675309 at yahoo dot com
2006-03-29  9:32 ` [Bug c++/26912] [4.0/4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
2006-04-16 19:11 ` mmitchel at gcc dot gnu dot org
2006-04-23 18:57 ` mmitchel at gcc dot gnu dot org
2006-04-24  3:50 ` mmitchel at gcc dot gnu dot org
2006-04-24  3:55 ` [Bug c++/26912] [4.0/4.1 " mmitchel at gcc dot gnu dot org
2006-05-01 15:11 ` mmitchel at gcc dot gnu dot org
2006-05-01 15:12 ` mmitchel at gcc dot gnu dot org
2006-05-01 15:13 ` [Bug c++/26912] [4.0 " mmitchel at gcc dot gnu dot org
2006-05-25  2:34 ` mmitchel at gcc dot gnu dot org
2006-05-25  3:39 ` fang at csl dot cornell dot edu
2006-05-25 16:33 ` pinskia at gcc dot gnu dot org
2007-02-03 16:26 ` gdr 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).