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

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