public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/11582] New: Odd error message with dynamically sized template arg printing
Date: Fri, 18 Jul 2003 22:25:00 -0000	[thread overview]
Message-ID: <20030718222516.11582.bangerth@dealii.org> (raw)

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.


             reply	other threads:[~2003-07-18 22:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-18 22:25 bangerth at dealii dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030718222516.11582.bangerth@dealii.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).