public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34399] [4.3 regression] ICE on invalid friend declaration of variadic template
  2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
@ 2007-12-08 23:05 ` reichelt at gcc dot gnu dot org
  2007-12-08 23:08 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-12-08 23:05 UTC (permalink / raw)
  To: gcc-bugs



-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

* [Bug c++/34399]  New: [4.3 regression] ICE on invalid friend declaration of variadic template
@ 2007-12-08 23:05 reichelt at gcc dot gnu dot org
  2007-12-08 23:05 ` [Bug c++/34399] " reichelt at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-12-08 23:05 UTC (permalink / raw)
  To: gcc-bugs

The following invalid code snippet triggers an ICE on mainline:

=================================================
template<int...> struct A
{
  void foo();
};

struct B
{
  template<int N> friend void A<N>::A::foo();
};
=================================================

bug.cc:8: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]


-- 
           Summary: [4.3 regression] ICE on invalid friend declaration of
                    variadic template
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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

* [Bug c++/34399] [4.3 regression] ICE on invalid friend declaration of variadic template
  2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
  2007-12-08 23:05 ` [Bug c++/34399] " reichelt at gcc dot gnu dot org
@ 2007-12-08 23:08 ` pinskia at gcc dot gnu dot org
  2007-12-12 20:58 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-08 23:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-12-08 23:08 -------
Confirmed, the only regression here is the error recovery one.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |error-recovery
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-08 23:08:12
               date|                            |


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


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

* [Bug c++/34399] [4.3 regression] ICE on invalid friend declaration of variadic template
  2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
  2007-12-08 23:05 ` [Bug c++/34399] " reichelt at gcc dot gnu dot org
  2007-12-08 23:08 ` pinskia at gcc dot gnu dot org
@ 2007-12-12 20:58 ` mmitchel at gcc dot gnu dot org
  2007-12-20 21:09 ` dgregor at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-12-12 20:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug c++/34399] [4.3 regression] ICE on invalid friend declaration of variadic template
  2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-12-12 20:58 ` mmitchel at gcc dot gnu dot org
@ 2007-12-20 21:09 ` dgregor at gcc dot gnu dot org
  2008-01-15  1:18 ` dgregor at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2007-12-20 21:09 UTC (permalink / raw)
  To: gcc-bugs



-- 

dgregor at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dgregor at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-12-08 23:08:12         |2007-12-20 21:09:31
               date|                            |


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


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

* [Bug c++/34399] [4.3 regression] ICE on invalid friend declaration of variadic template
  2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-12-20 21:09 ` dgregor at gcc dot gnu dot org
@ 2008-01-15  1:18 ` dgregor at gcc dot gnu dot org
  2008-01-15  1:54 ` dgregor at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2008-01-15  1:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dgregor at gcc dot gnu dot org  2008-01-15 00:24 -------
It's slightly more than an error-recovery issue, because we don't actually emit
an error before dying.


-- 


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


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

* [Bug c++/34399] [4.3 regression] ICE on invalid friend declaration of variadic template
  2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-01-15  1:18 ` dgregor at gcc dot gnu dot org
@ 2008-01-15  1:54 ` dgregor at gcc dot gnu dot org
  2008-01-15  1:54 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2008-01-15  1:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dgregor at gcc dot gnu dot org  2008-01-15 00:43 -------
So, this is another case where we have a bug in our handling of C++98 that just
happens to have been reported against variadic templates. The error in the code
example is that 'N' in the friend declaration needs to be a parameter pack,
e.g.,

  template<int... N> friend void A<N...>::A::foo();

That way, we're exactly matching the signature of the template A. The problem,
in the compiler, is that without this exact match we don't get to the primary
template's definition, and when we can't find A<N>::A we end up with a
TYPENAME_TYPE... not the kind of thing we want at this point.

In C++98, we can create the same issue by using non-type template parameters
that don't match types exactly, e.g.,

  template<int> struct X
  {
    void foo();
  };

  struct Y {
    template<long N> friend void X<N>::X::foo();
  };

That causes the same kind of ICE.

I'm looking into this issue now...


-- 


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


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

* [Bug c++/34399] [4.3 regression] ICE on invalid friend declaration of variadic template
  2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-01-15  1:54 ` dgregor at gcc dot gnu dot org
@ 2008-01-15  1:54 ` pinskia at gcc dot gnu dot org
  2008-01-15  2:40 ` dgregor at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-15  1:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-01-15 00:29 -------
(In reply to comment #2)
> It's slightly more than an error-recovery issue, because we don't actually emit
> an error before dying.

For normal mode non -std=c++0x mode, it is only an error recovery issue and
that is what I am going by.


-- 


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


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

* [Bug c++/34399] [4.3 regression] ICE on invalid friend declaration of variadic template
  2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-01-15  1:54 ` pinskia at gcc dot gnu dot org
@ 2008-01-15  2:40 ` dgregor at gcc dot gnu dot org
  2008-01-15 21:23 ` dgregor at gcc dot gnu dot org
  2008-01-15 21:25 ` dgregor at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2008-01-15  2:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dgregor at gcc dot gnu dot org  2008-01-15 01:03 -------
Patch here: http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00633.html


-- 


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


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

* [Bug c++/34399] [4.3 regression] ICE on invalid friend declaration of variadic template
  2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-01-15  2:40 ` dgregor at gcc dot gnu dot org
@ 2008-01-15 21:23 ` dgregor at gcc dot gnu dot org
  2008-01-15 21:25 ` dgregor at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2008-01-15 21:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dgregor at gcc dot gnu dot org  2008-01-15 20:57 -------
Subject: Bug 34399

Author: dgregor
Date: Tue Jan 15 20:56:55 2008
New Revision: 131552

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131552
Log:
2008-01-15  Douglas Gregor  <doug.gregor@gmail.com>

        PR c++/34399
        * friend.c (do_friend): Don't query TYPE_BEING_DEFINED unless we
        know we have a class type.

2008-01-15  Douglas Gregor  <doug.gregor@gmail.com>

        PR c++/34399
        * g++.dg/cpp0x/vt-34399.C: New.
        * g++.dg/template/friend50.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/vt-34399.C
    trunk/gcc/testsuite/g++.dg/template/friend50.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/friend.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/34399] [4.3 regression] ICE on invalid friend declaration of variadic template
  2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2008-01-15 21:23 ` dgregor at gcc dot gnu dot org
@ 2008-01-15 21:25 ` dgregor at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2008-01-15 21:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dgregor at gcc dot gnu dot org  2008-01-15 20:59 -------
Fixed in mainline


-- 

dgregor at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-01-15 21:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-08 23:05 [Bug c++/34399] New: [4.3 regression] ICE on invalid friend declaration of variadic template reichelt at gcc dot gnu dot org
2007-12-08 23:05 ` [Bug c++/34399] " reichelt at gcc dot gnu dot org
2007-12-08 23:08 ` pinskia at gcc dot gnu dot org
2007-12-12 20:58 ` mmitchel at gcc dot gnu dot org
2007-12-20 21:09 ` dgregor at gcc dot gnu dot org
2008-01-15  1:18 ` dgregor at gcc dot gnu dot org
2008-01-15  1:54 ` dgregor at gcc dot gnu dot org
2008-01-15  1:54 ` pinskia at gcc dot gnu dot org
2008-01-15  2:40 ` dgregor at gcc dot gnu dot org
2008-01-15 21:23 ` dgregor at gcc dot gnu dot org
2008-01-15 21:25 ` dgregor 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).