public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11582] New: Odd error message with dynamically sized template arg printing
@ 2003-07-18 22:25 bangerth at dealii dot org
  2003-07-18 22:52 ` [Bug c++/11582] " gdr at integrable-solutions dot net
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2003-07-18 22:25 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=11582

           Summary: Odd error message with dynamically sized template arg
                    printing
           Product: gcc
           Version: unknown
            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

Extracted from PR 6785: 
 
I guess this is totally irrelevant (because the code is invalid), but nevertheless: for this code 
------------------------------------------------- 
template <typename T> int  size(); 
template <int N>      void f(int (&)[N]); 
 
void g() { 
  int buf[size<int>()]; 
  f( buf ) ; 
} 
------------------------------------------------- 
we get the following error: 
tmp/gg> ../build-gcc/gcc-install/bin/c++ -c x.cc 
x.cc: In function `void g()': 
x.cc:6: error: no matching function for call to `f(int[size() [with T = int]()])' 
 
Note how we try to write the size of the array as an expression, which involves the 
call to a templated function, and where it tries to place the template arg when 
printing it. It is a little confusing to see the [with T=int] here, since T is nowhere referenced 
before or after, and the placing is odd. 
 
And then there is the duplicate () after the templates are printed. This can be seen here 
too: 
---------------------------------- 
int  size(); 
template <int N> void f(int (&)[N]); 
 
void g() { 
  int buf[size()]; 
  f( buf ) ; 
} 
------------------------------------- 
tmp/gg> ../build-gcc/gcc-install/bin/c++ -c x.cc 
x.cc: In function `void g()': 
x.cc:6: error: no matching function for call to `f(int[size()()])' 
 
I think that looks just cute ;-) 
 
W.


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

end of thread, other threads:[~2021-08-23 22:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-11582-4@http.gcc.gnu.org/bugzilla/>
2012-02-02  0:30 ` [Bug c++/11582] Odd error message with dynamically sized template arg printing pinskia at gcc dot gnu.org
2013-04-19 17:13 ` manu at gcc dot gnu.org
2013-04-22 10:10 ` gdr at gcc dot gnu.org
2013-04-22 10:38 ` manu at gcc dot gnu.org
2013-04-23  3:46 ` gdr at gcc dot gnu.org
2021-08-23 21:41 ` pinskia at gcc dot gnu.org
2021-08-23 22:45 ` bangerth at gmail dot com
2003-07-18 22:25 [Bug c++/11582] New: " bangerth at dealii dot org
2003-07-18 22:52 ` [Bug c++/11582] " gdr at integrable-solutions dot net
2003-07-19  2:31 ` pinskia at physics dot uc dot edu
2003-07-19  3:00 ` bangerth at dealii dot org
2003-08-17 12:43 ` pinskia at gcc dot gnu dot org
2003-08-23  0:51 ` dhazeghi at yahoo dot com
2003-11-23  7:04 ` pinskia 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).