public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3767: c++ ice-on-illegal code
@ 2001-08-05  2:09 lerdsuwa
  0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2001-08-05  2:09 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, mayer, nobody

Synopsis: c++ ice-on-illegal code

State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Sun Aug  5 02:09:47 2001
State-Changed-Why:
    Confirm as a bug.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3767&database=gcc


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

* c++/3767: c++ ice-on-illegal code
@ 2001-07-22 21:56 mayer
  0 siblings, 0 replies; 2+ messages in thread
From: mayer @ 2001-07-22 21:56 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3767
>Category:       c++
>Synopsis:       c++ ice-on-illegal code
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          ice-on-illegal-code
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 22 21:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Uwe F. Mayer
>Release:        3.0
>Organization:
tux.org
>Environment:
System: Linux tosca 2.2.18 #2 Thu Mar 8 13:48:25 PST 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.0/configure --disable-nls --prefix=/usr/local/gcc-3.0
>Description:
I used a declaration "T::Y *z;" for a template parameter T and a subclass Y
of the instantiated class T. The compiler decided that this is multiplication,
and gave me an internal compiler error. I am not sure whether the code I wrote
is actually legal. Here is the output of the compilation attempt:
g++ -Wall typename.cc
typename.cc: In member function `void X<T>::foo() [with T = Z]':
typename.cc:28:   instantiated from here
typename.cc:8: Internal compiler error in c_expand_expr, at c-common.c:4116
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.

>How-To-Repeat:
Compile the program typename.cc:
#include <iostream>
using namespace std;

template<class T>
class X {
public:
  void foo(){
    T::Y *z;                // situation interpreted by g++ as
                            // multiplication, not definition
    //typename T::Y * z;    // definition forced, compiles OK
  }
  int z;
};

class Z {
public:
  class Y {
  public:
    int i;
      friend int operator*(Z::Y y, int j);
  };
};

int operator*(Z::Y y, int j) {return(y.i*j);}

int main() {
  X<Z> x;
  x.foo();
}

>Fix:
Remove the ambiguity with "typename".
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2001-08-05  2:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-05  2:09 c++/3767: c++ ice-on-illegal code lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2001-07-22 21:56 mayer

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