public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/48617] New: [C++0x] Problem with non-type template parameters and decltype
Date: Fri, 15 Apr 2011 09:04:00 -0000	[thread overview]
Message-ID: <bug-48617-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: [C++0x] Problem with non-type template parameters and
                    decltype
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


gcc 4.7.0 in C++0x mode rejects the following program:

//---------------
template<class T, decltype(T())> // #
struct A {};

A<int, 0> a;

int main() {}
//---------------

The error message annotated at line # is:

"error: 'decltype (T())' is not a valid type for a template constant parameter"

It seems to me that according to the FDIS this should be well-formed program:
decltype is feasible as a /parameter-declaration/. The new type-equivalence
rules in [temp.type] p. 2,

"If an expression e involves a template parameter, decltype(e) denotes a unique
dependent type. Two such decltype-specifiers refer to the same type only if
their expressions are equivalent (14.5.6.1)."

should allow for a compiler to deduce the meaning similar to other dependent
contexts. See also [temp.dep.type] p. 8 for this matter:

"A type is dependent if it is [...] denoted by decltype(expression), where
expression is type-dependent (14.6.2.2)."


             reply	other threads:[~2011-04-15  9:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15  9:04 daniel.kruegler at googlemail dot com [this message]
2011-05-22 19:22 ` [Bug c++/48617] " jason at gcc dot gnu.org
2011-05-23 15:49 ` jason at gcc dot gnu.org
2011-05-25  1:51 ` jason at gcc dot gnu.org
2011-05-25  1:57 ` jason at gcc dot gnu.org
2011-06-18 19:16 ` 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=bug-48617-4@http.gcc.gnu.org/bugzilla/ \
    --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).