public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/38392]  New: Template friend function injection
@ 2008-12-04  2:38 H9XLrv5oXVNvHiUI at spambox dot us
  2008-12-04 23:38 ` [Bug c++/38392] " H9XLrv5oXVNvHiUI at spambox dot us
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2008-12-04  2:38 UTC (permalink / raw)
  To: gcc-bugs

When defining a friend function in a template class it does not get correctly
defined if the class instantiation comes after the function has been already
called. Note: this happens even if you pre-declare the function in its correct
context before the same function is called. 
The following is a code sample that reproduces the bug. Note that this has been
already discussed and concluded that this is valid c++ standard-compliant code
(precisely here:
http://groups.google.com/group/comp.lang.c++/browse_frm/thread/493afd501c807ffe#).

-- code --

void Function();

int main(int argc, char* argv[])
{
        Function(); // This does not work

}

template <typename T>
class Test
{
public:
        friend void Function() { printf("Function()"); getchar(); }

};

template class Test<int>;

-- end code --


-- 
           Summary: Template friend function injection
           Product: gcc
           Version: 4.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: H9XLrv5oXVNvHiUI at spambox dot us


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
@ 2008-12-04 23:38 ` H9XLrv5oXVNvHiUI at spambox dot us
  2008-12-16  1:04 ` H9XLrv5oXVNvHiUI at spambox dot us
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2008-12-04 23:38 UTC (permalink / raw)
  To: gcc-bugs



-- 

H9XLrv5oXVNvHiUI at spambox dot us changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
  2008-12-04 23:38 ` [Bug c++/38392] " H9XLrv5oXVNvHiUI at spambox dot us
@ 2008-12-16  1:04 ` H9XLrv5oXVNvHiUI at spambox dot us
  2008-12-16  1:07 ` pinskia at gcc dot gnu dot org
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2008-12-16  1:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from H9XLrv5oXVNvHiUI at spambox dot us  2008-12-16 01:03 -------
Any news?


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
  2008-12-04 23:38 ` [Bug c++/38392] " H9XLrv5oXVNvHiUI at spambox dot us
  2008-12-16  1:04 ` H9XLrv5oXVNvHiUI at spambox dot us
@ 2008-12-16  1:07 ` pinskia at gcc dot gnu dot org
  2008-12-16  1:10 ` pinskia at gcc dot gnu dot org
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-16  1:07 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (2 preceding siblings ...)
  2008-12-16  1:07 ` pinskia at gcc dot gnu dot org
@ 2008-12-16  1:10 ` pinskia at gcc dot gnu dot org
  2009-01-31 20:28 ` H9XLrv5oXVNvHiUI at spambox dot us
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-16  1:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-12-16 01:08 -------
Confirmed, not a regression.  If you swap around main and the template, the
link works correctly.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |link-failure
      Known to fail|                            |3.3.3 4.4.0 4.0.2
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-16 01:08:10
               date|                            |


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (3 preceding siblings ...)
  2008-12-16  1:10 ` pinskia at gcc dot gnu dot org
@ 2009-01-31 20:28 ` H9XLrv5oXVNvHiUI at spambox dot us
  2009-02-01  5:08 ` bangerth at gmail dot com
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2009-01-31 20:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from H9XLrv5oXVNvHiUI at spambox dot us  2009-01-31 20:28 -------
Sorry for the late reply!
I thought I'd receive an e-mail when one of my reports gets updated, silly me.

Yes I know it works if you switch the order, but that's exactly the point of
the code, to have them in that specific order and there's no reason why the
code as it is shouldn't work being it standard c++ right?


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (4 preceding siblings ...)
  2009-01-31 20:28 ` H9XLrv5oXVNvHiUI at spambox dot us
@ 2009-02-01  5:08 ` bangerth at gmail dot com
  2009-09-15  7:37 ` H9XLrv5oXVNvHiUI at spambox dot us
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: bangerth at gmail dot com @ 2009-02-01  5:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bangerth at gmail dot com  2009-02-01 05:07 -------
Confirmed indeed, with this (linker) error message:

g/x> c++ x.cc
/tmp/ccjPvb3J.o: In function `main':
x.cc:(.text+0x12): undefined reference to `Function()'
collect2: ld returned 1 exit status

This already fails with gcc2.95.

W.


-- 

bangerth at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at gmail dot com
      Known to fail|3.3.3 4.4.0 4.0.2           |3.3.3 4.4.0 4.0.2 2.95.3


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (5 preceding siblings ...)
  2009-02-01  5:08 ` bangerth at gmail dot com
@ 2009-09-15  7:37 ` H9XLrv5oXVNvHiUI at spambox dot us
  2009-12-22 21:52 ` H9XLrv5oXVNvHiUI at spambox dot us
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2009-09-15  7:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from H9XLrv5oXVNvHiUI at spambox dot us  2009-09-15 07:37 -------
Any update about this?


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (6 preceding siblings ...)
  2009-09-15  7:37 ` H9XLrv5oXVNvHiUI at spambox dot us
@ 2009-12-22 21:52 ` H9XLrv5oXVNvHiUI at spambox dot us
  2009-12-22 22:15 ` paolo dot carlini at oracle dot com
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2009-12-22 21:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from H9XLrv5oXVNvHiUI at spambox dot us  2009-12-22 21:52 -------
Did anyone try this against 4.5? Considering that at this stage only bugfixes
are accepted in the codebase for the next release I'd really like to see a
possible fix to this in. I tried to compile GCC 4.5 on my machine without much
success.


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (7 preceding siblings ...)
  2009-12-22 21:52 ` H9XLrv5oXVNvHiUI at spambox dot us
@ 2009-12-22 22:15 ` paolo dot carlini at oracle dot com
  2009-12-23 11:02 ` redi at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-22 22:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from paolo dot carlini at oracle dot com  2009-12-22 22:15 -------
Doesn't link with 4.5.0. And doesn't link with ICC and SunStudio either, thus,
I'm rather skeptical it should. I also skimmed quickly through the discussion
on comp.lang.c++ and didn't notice any neat statement... maybe should look
better.


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (8 preceding siblings ...)
  2009-12-22 22:15 ` paolo dot carlini at oracle dot com
@ 2009-12-23 11:02 ` redi at gcc dot gnu dot org
  2009-12-24 14:48 ` H9XLrv5oXVNvHiUI at spambox dot us
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-12-23 11:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from redi at gcc dot gnu dot org  2009-12-23 11:02 -------
See http://www.open-std.org/jtc1/sc22/wg21/prot/14882fdis/cwg_defects.html#329

I believe a "use" of the function must come after the definition for it to be
instantiated, indeed if I add this after the explicit instantiation it links
OK:

void(*pf)() = &Function;


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (9 preceding siblings ...)
  2009-12-23 11:02 ` redi at gcc dot gnu dot org
@ 2009-12-24 14:48 ` H9XLrv5oXVNvHiUI at spambox dot us
  2009-12-24 15:39 ` paolo dot carlini at oracle dot com
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2009-12-24 14:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from H9XLrv5oXVNvHiUI at spambox dot us  2009-12-24 14:48 -------
I know if you move the function it links (btw your link asks me for an HTTP
login), but if you follow the discussion in the newsgroup it was concluded that
this (the above) is actually perfectly valid standard C++ code, and anyway I
think at least the error the linker gives could be more descriptive. Also the
fact that other compilers fail with this code it's just because it's fairly
rarely used code. For instance, Open Watcom compiled and linked the code
perfectly fine without issues (and the executable was working).


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (10 preceding siblings ...)
  2009-12-24 14:48 ` H9XLrv5oXVNvHiUI at spambox dot us
@ 2009-12-24 15:39 ` paolo dot carlini at oracle dot com
  2009-12-24 17:24 ` H9XLrv5oXVNvHiUI at spambox dot us
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-24 15:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from paolo dot carlini at oracle dot com  2009-12-24 15:39 -------
Try this one:

  http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#329

Anyway, if you could point us to the specific sentence in the thread saying
that it's legal, it would be useful. And, well, frankly I would not trust
Watcom more than Intel and Sun (and GCC) together ;) But let's CC Jason, maybe
he wants to give his opinion...


-- 

paolo dot carlini at oracle dot com changed:

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


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (11 preceding siblings ...)
  2009-12-24 15:39 ` paolo dot carlini at oracle dot com
@ 2009-12-24 17:24 ` H9XLrv5oXVNvHiUI at spambox dot us
  2009-12-24 21:47 ` jason at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2009-12-24 17:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from H9XLrv5oXVNvHiUI at spambox dot us  2009-12-24 17:23 -------
This is possibly the part in which gets confirmed that the code is standard
compliant, although it reports the exact same paragraph you linked (the old
version):
http://groups.google.com/group/comp.lang.c++/tree/browse_frm/thread/493afd501c807ffe/68c709135884bac7?rnum=11&_done=%2Fgroup%2Fcomp.lang.c%2B%2B%2Fbrowse_frm%2Fthread%2F493afd501c807ffe%3F#doc_38f8441247122dcd

I guess that page is some kind of errata corrige? 
Anyway maybe I'm missing something but I see that as a conflict. If I recall
correctly it is stated that the context of a injected friend function must not
be ambiguous, thus meaning you have to declare it first in the correct
namespace. The idea of declaration is that you inform the compiler that the
function exists somewhere so that you can use it without having it defined yet.
If friend function injection is just like defining the function in the parent
namespace of the class and if a template exists as a type (at linking level)
only when you create an instance of that type, it means the moment you
instantiate the template, then the type is defined and consequently the friend
function is injected, thus matching with the declaration done before, thus
matching with the call that used that declaration.
As I pointed in that newsgroup thread, it works fine with normal classes, and
theoretically a template is just a class in the second you create an instance
of it. I don't precisely understand why there should be an exception for
templates. I understand not defining the function if you don't create any
instance of the template, but otherwise it's a bit unclear to me why there
should be this exception. 


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (12 preceding siblings ...)
  2009-12-24 17:24 ` H9XLrv5oXVNvHiUI at spambox dot us
@ 2009-12-24 21:47 ` jason at gcc dot gnu dot org
  2009-12-24 21:49 ` jason at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-12-24 21:47 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-12-16 01:08:10         |2009-12-24 21:47:32
               date|                            |


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (13 preceding siblings ...)
  2009-12-24 21:47 ` jason at gcc dot gnu dot org
@ 2009-12-24 21:49 ` jason at gcc dot gnu dot org
  2009-12-24 21:55 ` paolo dot carlini at oracle dot com
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-12-24 21:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jason at gcc dot gnu dot org  2009-12-24 21:48 -------
Created an attachment (id=19387)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19387&action=view)
patch

Here's a fix.  I'm going to hold off on applying it for now since it isn't a
regression.


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (14 preceding siblings ...)
  2009-12-24 21:49 ` jason at gcc dot gnu dot org
@ 2009-12-24 21:55 ` paolo dot carlini at oracle dot com
  2009-12-24 22:14 ` jason at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-24 21:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from paolo dot carlini at oracle dot com  2009-12-24 21:55 -------
Cool. Should the testcase use dg-do link?


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (15 preceding siblings ...)
  2009-12-24 21:55 ` paolo dot carlini at oracle dot com
@ 2009-12-24 22:14 ` jason at gcc dot gnu dot org
  2009-12-24 22:15 ` H9XLrv5oXVNvHiUI at spambox dot us
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-12-24 22:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from jason at gcc dot gnu dot org  2009-12-24 22:14 -------
Ah, good point.  I've updated the patch accordingly in my local pre-4.6 git
branch.


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (16 preceding siblings ...)
  2009-12-24 22:14 ` jason at gcc dot gnu dot org
@ 2009-12-24 22:15 ` H9XLrv5oXVNvHiUI at spambox dot us
  2009-12-25  9:53 ` paolo dot carlini at oracle dot com
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2009-12-24 22:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from H9XLrv5oXVNvHiUI at spambox dot us  2009-12-24 22:15 -------
Hey thank you! I'd like to test the patch if I only I'd be able to compile 4.5
successfully. You have any idea on when could this patch make it to a final
release?


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (17 preceding siblings ...)
  2009-12-24 22:15 ` H9XLrv5oXVNvHiUI at spambox dot us
@ 2009-12-25  9:53 ` paolo dot carlini at oracle dot com
  2009-12-25 10:42 ` H9XLrv5oXVNvHiUI at spambox dot us
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-25  9:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from paolo dot carlini at oracle dot com  2009-12-25 09:53 -------
As Jason confirmed, this is not a regression, thus, post 4.5.0.


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (18 preceding siblings ...)
  2009-12-25  9:53 ` paolo dot carlini at oracle dot com
@ 2009-12-25 10:42 ` H9XLrv5oXVNvHiUI at spambox dot us
  2009-12-25 10:48 ` paolo dot carlini at oracle dot com
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2009-12-25 10:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from H9XLrv5oXVNvHiUI at spambox dot us  2009-12-25 10:42 -------
Ok I managed to compile GCC 4.5, applied the patch and compiled the test code
above and everything works fine. Thanks again!
And yes, I imagined it would have been post 4.5 but I meant 'when' from a time
frame point of view, that's why I said "you have any idea" as I know it's hard
to predict a specific time for release.


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (19 preceding siblings ...)
  2009-12-25 10:42 ` H9XLrv5oXVNvHiUI at spambox dot us
@ 2009-12-25 10:48 ` paolo dot carlini at oracle dot com
  2009-12-25 11:02 ` H9XLrv5oXVNvHiUI at spambox dot us
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-25 10:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from paolo dot carlini at oracle dot com  2009-12-25 10:48 -------
If I were you, I would not use this kind of C++ at all, for the time being. As
we discussed already, it's *very* weakly supported and your software would not
be portable.


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (20 preceding siblings ...)
  2009-12-25 10:48 ` paolo dot carlini at oracle dot com
@ 2009-12-25 11:02 ` H9XLrv5oXVNvHiUI at spambox dot us
  2009-12-25 11:06 ` paolo dot carlini at oracle dot com
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: H9XLrv5oXVNvHiUI at spambox dot us @ 2009-12-25 11:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from H9XLrv5oXVNvHiUI at spambox dot us  2009-12-25 11:02 -------
Yeah I know, but consider that I used this code only in a specific circumstance
and does not constitute a core part of my application (or a foundation of some
higher level mechanism). And I know it's a lot like an exploit but it does
allow me to add a tiny yet very slick feature to my code. 
Also I checked and they fixed this in visual c++ 2010 as well (after my
report), so having the two major compilers supporting this code is good enough
for me.


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (21 preceding siblings ...)
  2009-12-25 11:02 ` H9XLrv5oXVNvHiUI at spambox dot us
@ 2009-12-25 11:06 ` paolo dot carlini at oracle dot com
  2010-04-07 15:55 ` jason at gcc dot gnu dot org
  2010-05-04  4:54 ` jason at gcc dot gnu dot org
  24 siblings, 0 replies; 26+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-25 11:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from paolo dot carlini at oracle dot com  2009-12-25 11:06 -------
Then wait, good luck


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (22 preceding siblings ...)
  2009-12-25 11:06 ` paolo dot carlini at oracle dot com
@ 2010-04-07 15:55 ` jason at gcc dot gnu dot org
  2010-05-04  4:54 ` jason at gcc dot gnu dot org
  24 siblings, 0 replies; 26+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-04-07 15:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from jason at gcc dot gnu dot org  2010-04-07 15:55 -------
Subject: Bug 38392

Author: jason
Date: Wed Apr  7 15:54:42 2010
New Revision: 158073

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158073
Log:
        PR c++/38392
        * pt.c (tsubst_friend_function): Instatiate a friend that has already
        been used.

Added:
    trunk/gcc/testsuite/g++.dg/template/friend51.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/38392] Template friend function injection
  2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
                   ` (23 preceding siblings ...)
  2010-04-07 15:55 ` jason at gcc dot gnu dot org
@ 2010-05-04  4:54 ` jason at gcc dot gnu dot org
  24 siblings, 0 replies; 26+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-05-04  4:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from jason at gcc dot gnu dot org  2010-05-04 04:54 -------
Fixed for 4.6.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-05-04  4:54 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-04  2:38 [Bug c++/38392] New: Template friend function injection H9XLrv5oXVNvHiUI at spambox dot us
2008-12-04 23:38 ` [Bug c++/38392] " H9XLrv5oXVNvHiUI at spambox dot us
2008-12-16  1:04 ` H9XLrv5oXVNvHiUI at spambox dot us
2008-12-16  1:07 ` pinskia at gcc dot gnu dot org
2008-12-16  1:10 ` pinskia at gcc dot gnu dot org
2009-01-31 20:28 ` H9XLrv5oXVNvHiUI at spambox dot us
2009-02-01  5:08 ` bangerth at gmail dot com
2009-09-15  7:37 ` H9XLrv5oXVNvHiUI at spambox dot us
2009-12-22 21:52 ` H9XLrv5oXVNvHiUI at spambox dot us
2009-12-22 22:15 ` paolo dot carlini at oracle dot com
2009-12-23 11:02 ` redi at gcc dot gnu dot org
2009-12-24 14:48 ` H9XLrv5oXVNvHiUI at spambox dot us
2009-12-24 15:39 ` paolo dot carlini at oracle dot com
2009-12-24 17:24 ` H9XLrv5oXVNvHiUI at spambox dot us
2009-12-24 21:47 ` jason at gcc dot gnu dot org
2009-12-24 21:49 ` jason at gcc dot gnu dot org
2009-12-24 21:55 ` paolo dot carlini at oracle dot com
2009-12-24 22:14 ` jason at gcc dot gnu dot org
2009-12-24 22:15 ` H9XLrv5oXVNvHiUI at spambox dot us
2009-12-25  9:53 ` paolo dot carlini at oracle dot com
2009-12-25 10:42 ` H9XLrv5oXVNvHiUI at spambox dot us
2009-12-25 10:48 ` paolo dot carlini at oracle dot com
2009-12-25 11:02 ` H9XLrv5oXVNvHiUI at spambox dot us
2009-12-25 11:06 ` paolo dot carlini at oracle dot com
2010-04-07 15:55 ` jason at gcc dot gnu dot org
2010-05-04  4:54 ` jason 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).