public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48617] New: [C++0x] Problem with non-type template parameters and decltype
@ 2011-04-15  9:04 daniel.kruegler at googlemail dot com
  2011-05-22 19:22 ` [Bug c++/48617] " jason at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-04-15  9:04 UTC (permalink / raw)
  To: gcc-bugs

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)."


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

end of thread, other threads:[~2011-06-18 19:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-15  9:04 [Bug c++/48617] New: [C++0x] Problem with non-type template parameters and decltype daniel.kruegler at googlemail dot com
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

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).