public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54665] New: [C++11] template alias to template does not work
@ 2012-09-21 22:09 mw_triad at users dot sourceforge.net
  2012-09-21 23:47 ` [Bug c++/54665] " paolo.carlini at oracle dot com
  0 siblings, 1 reply; 2+ messages in thread
From: mw_triad at users dot sourceforge.net @ 2012-09-21 22:09 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54665
           Summary: [C++11] template alias to template does not work
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mw_triad@users.sourceforge.net


Template aliases, as described in N2258[1], are not fully implemented.
Specifically, they do not work if the type being aliased is itself a template.

Simple test case (taken from Wikipedia[2]):

template <typename First, typename Second, int Third>
class SomeType;
class OtherType;

template <typename Second>
using TypedefName = typename SomeType<OtherType, Second, 5>;

int main()
{
  return 0;
}


This fails to compile with the error:

$ gcc -std=c++11 template-alias.cpp
template-alias.cpp:6:30: error: expected nested-name-specifier



[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
[2] http://en.wikipedia.org/wiki/C++11#Alias_templates


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

* [Bug c++/54665] [C++11] template alias to template does not work
  2012-09-21 22:09 [Bug c++/54665] New: [C++11] template alias to template does not work mw_triad at users dot sourceforge.net
@ 2012-09-21 23:47 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 2+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-09-21 23:47 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-09-21 23:46:39 UTC ---
The correct syntax is:

template <typename Second>
using TypedefName = SomeType<OtherType, Second, 5>;

ie, no "typename". You can find a good set of examples in the testsuite as:
testsuite/g++.dg/cpp0x/alias-decl-*


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

end of thread, other threads:[~2012-09-21 23:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-21 22:09 [Bug c++/54665] New: [C++11] template alias to template does not work mw_triad at users dot sourceforge.net
2012-09-21 23:47 ` [Bug c++/54665] " paolo.carlini at oracle dot com

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