public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Error in 971122 i686-pc-linux-gnu
@ 1997-11-27 19:10 Ross Alexander
  1997-11-27 22:49 ` Mark Mitchell
  0 siblings, 1 reply; 5+ messages in thread
From: Ross Alexander @ 1997-11-27 19:10 UTC (permalink / raw)
  To: egcs; +Cc: law

I get an error 9 in the following code
----------------------------------------------------------------------
template <class X> int foo<X> (X a)
{
  X::A b; // = a;
}
----------------------------------------------------------------------
stimpy:~$ g++ -v test.cc
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.90.18/specs
gcc version egcs-2.90.18 971122 (gcc2-970802 experimental)
 /usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.90.18/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Di386 -Di686 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -D__i686__ -Asystem(unix) -Acpu(i386) -Amachine(i386) test.cc /tmp/cca11795.ii
GNU CPP version egcs-2.90.18 971122 (gcc2-970802 experimental) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/local/include
 /usr/i686-pc-linux-gnu/include
 /usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.90.18/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.90.18/cc1plus /tmp/cca11795.ii -quiet -dumpbase test.cc -version -o /tmp/cca11795.s
GNU C++ version egcs-2.90.18 971122 (gcc2-970802 experimental) (i686-pc-linux-gnu) compiled by GNU C version egcs-2.90.16 971105 (gcc2-970802 experimental).
test.cc:2: Internal compiler error 9.
test.cc:2: Please submit a full bug report to `egcs-bugs@cygnus.com'.
stimpy:~$ 
----------------------------------------------------------------------

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

* Error in 971122 i686-pc-linux-gnu
  1997-11-27 19:10 Error in 971122 i686-pc-linux-gnu Ross Alexander
@ 1997-11-27 22:49 ` Mark Mitchell
  1997-11-28  1:30   ` Jason Merrill
  1997-11-28  2:23   ` Jason Merrill
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Mitchell @ 1997-11-27 22:49 UTC (permalink / raw)
  To: Ross Alexander; +Cc: egcs, law, Jason Merrill

Jason et. al. --

  I wonder if the implicit typename stuff should be disabled for the
release.  There seem to be a lot of internal errors being reported in
cases where the users should have used 'typename'.  (Ross, your code
is illegal: you have to say 'typename X::A'.)  At the very least, we
could issue a warning on this so that users would have a hint about
what they might do to avoid triggering the crash.

>>>>> "Ross" == Ross Alexander <rossa@stimpy.math.auckland.ac.nz> writes:

    Ross> I get an error 9 in the following code
    Ross> ----------------------------------------------------------------------
    Ross> template <class X> int foo<X> (X a) { X::A b; // = a; }
    Ross> ----------------------------------------------------------------------
    Ross> stimpy:~$ g++ -v test.cc Reading specs from
    Ross> experimental).  test.cc:2: Internal compiler error 9.
    Ross> test.cc:2: Please submit a full bug report to
    Ross> `egcs-bugs@cygnus.com'.  stimpy:~$
    Ross> ----------------------------------------------------------------------

-- 
Mark Mitchell		mmitchell@usa.net
Stanford University	http://www.stanford.edu


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

* Re: Error in 971122 i686-pc-linux-gnu
  1997-11-27 22:49 ` Mark Mitchell
@ 1997-11-28  1:30   ` Jason Merrill
  1997-11-28  2:23   ` Jason Merrill
  1 sibling, 0 replies; 5+ messages in thread
From: Jason Merrill @ 1997-11-28  1:30 UTC (permalink / raw)
  To: mmitchell; +Cc: Ross Alexander, egcs, law

>>>>> Mark Mitchell <mmitchell@usa.net> writes:

>   I wonder if the implicit typename stuff should be disabled for the
> release.  There seem to be a lot of internal errors being reported in
> cases where the users should have used 'typename'.

Ross> ----------------------------------------------------------------------
Ross> template <class X> int foo<X> (X a) { X::A b; // = a; }
Ross> ----------------------------------------------------------------------

This crash is caused by foo<X>, not X::A.  You can't use a template-id when
defining a primary template.

Jason

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

* Re: Error in 971122 i686-pc-linux-gnu
  1997-11-27 22:49 ` Mark Mitchell
  1997-11-28  1:30   ` Jason Merrill
@ 1997-11-28  2:23   ` Jason Merrill
  1997-12-01 18:46     ` C9X draft online Oleg Krivosheev
  1 sibling, 1 reply; 5+ messages in thread
From: Jason Merrill @ 1997-11-28  2:23 UTC (permalink / raw)
  To: mmitchell; +Cc: Ross Alexander, egcs, law

Fri Nov 28 01:58:14 1997  Jason Merrill  <jason@yorick.cygnus.com>

	* pt.c (check_explicit_specialization): Complain about using a 
	template-id for a non-specialization.

Fri Nov 28 01:56:35 1997  Bruno Haible  <bruno@linuix.mathematik.uni-karlsruhe.de>

        * error.c (dump_decl): Handle TEMPLATE_ID_EXPR.

Index: error.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/cp/error.c,v
retrieving revision 1.87
diff -c -r1.87 error.c
*** error.c	1997/11/19 19:52:28	1.87
--- error.c	1997/11/28 09:57:11
***************
*** 776,781 ****
--- 776,799 ----
        }
        break;
  
+     case TEMPLATE_ID_EXPR:
+       {
+ 	tree args;
+ 	dump_type (TREE_OPERAND (t, 0), v);
+ 	OB_PUTC ('<');
+ 	for (args = TREE_OPERAND (t, 1); args; args = TREE_CHAIN (args))
+ 	  {
+ 	    if (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (args))) == 't')
+ 	      dump_type (TREE_VALUE (args), 0);
+ 	    else
+ 	      dump_expr (TREE_VALUE (args), 0);
+ 	    if (TREE_CHAIN (args))
+ 	      OB_PUTC2 (',', ' ');
+ 	  }
+ 	OB_PUTC ('>');
+       }
+       break;
+ 
      case LABEL_DECL:
        OB_PUTID (DECL_NAME (t));
        break;
Index: pt.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/cp/pt.c,v
retrieving revision 1.270
diff -c -r1.270 pt.c
*** pt.c	1997/11/27 19:25:31	1.270
--- pt.c	1997/11/28 10:18:15
***************
*** 496,507 ****
  	  && !processing_explicit_specialization (template_count)
  	  && !is_friend)
  	{
! 	  if (!have_def)
  	    /* This is not an explicit specialization.  It must be
  	       an explicit instantiation.  */
  	    return 2;
  	  else if (pedantic)
! 	    pedwarn ("Explicit specialization not preceeded by `template <>'");
  	}
  
        if (TREE_CODE (declarator) != TEMPLATE_ID_EXPR)
--- 496,514 ----
  	  && !processing_explicit_specialization (template_count)
  	  && !is_friend)
  	{
! 	  if (!have_def && ! template_header_count)
  	    /* This is not an explicit specialization.  It must be
  	       an explicit instantiation.  */
  	    return 2;
+ 	  else if (template_header_count > template_count
+ 		   && !processing_specialization)
+ 	    {
+ 	      cp_error ("template-id `%D' in declaration of primary template",
+ 			declarator);
+ 	      return 0;
+ 	    }
  	  else if (pedantic)
! 	    pedwarn ("explicit specialization not preceeded by `template <>'");
  	}
  
        if (TREE_CODE (declarator) != TEMPLATE_ID_EXPR)

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

* C9X draft online
  1997-11-28  2:23   ` Jason Merrill
@ 1997-12-01 18:46     ` Oleg Krivosheev
  0 siblings, 0 replies; 5+ messages in thread
From: Oleg Krivosheev @ 1997-12-01 18:46 UTC (permalink / raw)
  To: gcc2; +Cc: egcs

i think it might be of general interest...

http://www.dkuug.dk/JTC1/SC22/WG14/www/docs/n794.htm


OK


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

end of thread, other threads:[~1997-12-01 18:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-27 19:10 Error in 971122 i686-pc-linux-gnu Ross Alexander
1997-11-27 22:49 ` Mark Mitchell
1997-11-28  1:30   ` Jason Merrill
1997-11-28  2:23   ` Jason Merrill
1997-12-01 18:46     ` C9X draft online Oleg Krivosheev

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