public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11811] New: Weird error message with default template arguments
@ 2003-08-05 18:33 bangerth at dealii dot org
  2003-08-05 18:37 ` [Bug c++/11811] " pinskia at physics dot uc dot edu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2003-08-05 18:33 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Weird error message with default template arguments
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org
                CC: gcc-bugs at gcc dot gnu dot org,gdr at gcc dot gnu dot
                    org

Consider the following code:
-------------------------
void foo(int);

template <typename>
void bar() {
  foo;
}

template void bar<int>();
--------------------------
With present mainline, we get the following message:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `void bar() [with <template default argument error> = int]':
x.cc:8:   instantiated from here
x.cc:5: warning: statement is a reference, not call, to function `foo(int)'


Note the string "<template default argument error>". That's weird,
because the error is certainly not in the default argument. It
seems to me as if the expression dumper just has a problem here,
but I better leave this judgement to those who know better.

Another weird point: if one removes the declaration of foo(), i.e.
--------------------------------
template <typename>
void bar() {
  foo;
}

template void bar<int>();
--------------------------------
then we get a message that doesn't even say that bar is a template:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `void bar()':
x.cc:3: error: `foo' undeclared (first use this function)
x.cc:3: error: (Each undeclared identifier is reported only once for each
   function it appears in.)

That's at best inconsistent.

W.


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

* [Bug c++/11811] Weird error message with default template arguments
  2003-08-05 18:33 [Bug c++/11811] New: Weird error message with default template arguments bangerth at dealii dot org
@ 2003-08-05 18:37 ` pinskia at physics dot uc dot edu
  2003-08-05 18:38 ` gdr at integrable-solutions dot net
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-05 18:37 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-05 18:37:34
               date|                            |


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-05 18:37 -------
I can confirm this on the mainline (20030805).  2.95.3 did not warn at all.
3.0.4 used {} instead <> for template default argument error which is just as confusing.


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

* [Bug c++/11811] Weird error message with default template arguments
  2003-08-05 18:33 [Bug c++/11811] New: Weird error message with default template arguments bangerth at dealii dot org
  2003-08-05 18:37 ` [Bug c++/11811] " pinskia at physics dot uc dot edu
@ 2003-08-05 18:38 ` gdr at integrable-solutions dot net
  2003-08-05 18:40 ` [Bug c++/11811] Weird " pinskia at physics dot uc dot edu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-08-05 18:38 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From gdr at integrable-solutions dot net  2003-08-05 18:38 -------
Subject: Re:  New: Weird error message with default template arguments


please assign this to me.


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

* [Bug c++/11811] Weird message with default template arguments
  2003-08-05 18:33 [Bug c++/11811] New: Weird error message with default template arguments bangerth at dealii dot org
  2003-08-05 18:37 ` [Bug c++/11811] " pinskia at physics dot uc dot edu
  2003-08-05 18:38 ` gdr at integrable-solutions dot net
@ 2003-08-05 18:40 ` pinskia at physics dot uc dot edu
  2003-08-29  7:00 ` cvs-commit at gcc dot gnu dot org
  2003-08-29  7:11 ` gdr at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-05 18:40 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |gdr at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-05 18:40 -------
What is funny is that changing typename to int and int to say 1, gcc produces:
pr11811.cc: In function `void bar() [with int <anonymous> = 1]':
pr11811.cc:8:   instantiated from here
pr11811.cc:5: warning: statement is a reference, not call, to function `
   foo(int)'
Which looks right.

Assigning to GDR.


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

* [Bug c++/11811] Weird message with default template arguments
  2003-08-05 18:33 [Bug c++/11811] New: Weird error message with default template arguments bangerth at dealii dot org
                   ` (2 preceding siblings ...)
  2003-08-05 18:40 ` [Bug c++/11811] Weird " pinskia at physics dot uc dot edu
@ 2003-08-29  7:00 ` cvs-commit at gcc dot gnu dot org
  2003-08-29  7:11 ` gdr at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-08-29  7:00 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-08-29 07:00 -------
Subject: Bug 11811

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	gdr@gcc.gnu.org	2003-08-29 07:00:32

Modified files:
	gcc/cp         : ChangeLog cxx-pretty-print.c cxx-pretty-print.h 
	                 error.c 

Log message:
	PR c++/11811
	* cxx-pretty-print.c (pp_cxx_canonical_template_parameter): New
	function.
	* cxx-pretty-print.h: Declare.
	* error.c (dump_template_parameter): Use it.
	(dump_type): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3629&r2=1.3630
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cxx-pretty-print.c.diff?cvsroot=gcc&r1=1.4&r2=1.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cxx-pretty-print.h.diff?cvsroot=gcc&r1=1.3&r2=1.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.232&r2=1.233


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

* [Bug c++/11811] Weird message with default template arguments
  2003-08-05 18:33 [Bug c++/11811] New: Weird error message with default template arguments bangerth at dealii dot org
                   ` (3 preceding siblings ...)
  2003-08-29  7:00 ` cvs-commit at gcc dot gnu dot org
@ 2003-08-29  7:11 ` gdr at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: gdr at gcc dot gnu dot org @ 2003-08-29  7:11 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


gdr at gcc dot gnu dot org changed:

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


------- Additional Comments From gdr at gcc dot gnu dot org  2003-08-29 07:11 -------
Fixed on mainline.  The inconsistency is something unrelated and should
be considered separately.


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

end of thread, other threads:[~2003-08-29  7:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-05 18:33 [Bug c++/11811] New: Weird error message with default template arguments bangerth at dealii dot org
2003-08-05 18:37 ` [Bug c++/11811] " pinskia at physics dot uc dot edu
2003-08-05 18:38 ` gdr at integrable-solutions dot net
2003-08-05 18:40 ` [Bug c++/11811] Weird " pinskia at physics dot uc dot edu
2003-08-29  7:00 ` cvs-commit at gcc dot gnu dot org
2003-08-29  7:11 ` 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).