public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/40315] template instantiation fails when using const typename
Date: Wed, 26 Aug 2009 14:52:00 -0000	[thread overview]
Message-ID: <20090826145155.30959.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40315-17781@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from redi at gcc dot gnu dot org  2009-08-26 14:51 -------
(In reply to comment #2)
> IIUC, the top-level const qualifier on "const typename Foo<D>::double3" in the
> primary template applies to the type, which is not known during phase 1

i.e. it's equivalent to "typename Foo<D>::double3 const" which is equivalent to
simply "typename Foo<D>::double3) because top-level cv-qualifiers are removed
from function parameters.

but when double3 is known to be an array type, which is replaced by a pointer
in a parameter list, then the declaration's meaning changes.

Consider:

typedef double  double3[3];
void f(const double3);
typedef void (*ptr)(const double*);
ptr p = f;

This demonstrates that the declaration of 'f' is equivalent to:

void f(const double*);

not

void f(double* const);

According to [dcl.fct] array parameters are replaced with pointers before
top-level cv-qualifiers are deleted.

I think GCC is correct, the template specializations are invalid.


-- 


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


  parent reply	other threads:[~2009-08-26 14:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-31 13:15 [Bug c++/40315] New: " doriankrause at web dot de
2009-08-25 15:39 ` [Bug c++/40315] " bangerth at gmail dot com
2009-08-26 14:43 ` redi at gcc dot gnu dot org
2009-08-26 14:52 ` redi at gcc dot gnu dot org [this message]
2009-08-26 19:26 ` doriankrause at web dot de
2009-11-08  4:33 ` jason at gcc dot gnu dot org
2009-11-08  4:37 ` jason at gcc dot gnu dot org
2009-11-08 23:06 ` jason at gcc dot gnu dot org
2009-11-08 23:32 ` jason at gcc dot gnu dot org
2009-11-08 23:41 ` paolo dot carlini at oracle dot com
2010-02-19 21:22 ` jason at gcc dot gnu dot org
2010-02-19 21:45 ` jason at gcc dot gnu dot org
2010-02-19 21:46 ` jason at gcc dot gnu dot org
     [not found] <bug-40315-4@http.gcc.gnu.org/bugzilla/>
2011-05-04 17:42 ` redi at gcc dot gnu.org
2011-05-04 18:31 ` jason at gcc dot gnu.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=20090826145155.30959.qmail@sourceware.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).