public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: carlo@alinoe.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/7468: prototype "doesn't match" a candidate that is actually a perfect match.
Date: Thu, 01 Aug 2002 19:56:00 -0000	[thread overview]
Message-ID: <20020802025341.31090.qmail@sources.redhat.com> (raw)


>Number:         7468
>Category:       c++
>Synopsis:       prototype "doesn't match" a candidate that is actually a perfect match.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 01 19:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     carlo@alinoe.com
>Release:        all releases (2.95, 2.96, 3.0.x, 3.1)
>Organization:
>Environment:

>Description:
The compiler aborts compilation with an error
along the lines off:

troep.cc:10: prototype for `bitset<n>::bitset(int (*)[bitset<n>::digits])' does
   not match any in class `bitset<n>'
troep.cc:6: candidate is: bitset<n>::bitset(int (*)[bitset<n>::digits])
>How-To-Repeat:
Compile this:

template<unsigned int n>
  class bitset {
    public:
      static int const digits = 4;
      typedef int foo_t[digits];
      bitset(foo_t*);
  };

template<unsigned int n>
  bitset<n>::bitset(foo_t*) { }

Note that the error goes away
when either
1) the template is removed
2) the static const is removed and '4' is put directly in the typedef
3) the typedef is replaced by a more normal typedef
4) the (foo_t*) is replaced with (foo_t)

Very peculiar bug.
>Fix:
Put the body inside the class declaration.
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-08-02  2:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-01 19:56 carlo [this message]
2002-08-02  2:06 Gabriel Dos Reis
2002-08-02  5:26 Carlo Wood
2002-08-02  6:46 Gabriel Dos Reis
2002-09-13 16:35 nathan
2003-01-28 16:53 bangerth

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=20020802025341.31090.qmail@sources.redhat.com \
    --to=carlo@alinoe.com \
    --cc=gcc-gnats@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).