public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51593] New: alias templates fail in dependent contexts requiring ::template
@ 2011-12-16 22:49 public at alisdairm dot net
  2011-12-16 22:55 ` [Bug c++/51593] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: public at alisdairm dot net @ 2011-12-16 22:49 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51593
           Summary: alias templates fail in dependent contexts requiring
                    ::template
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: public@alisdairm.net


The following code is sufficient to demonstrate:

template<typename T>
struct wrap {
template<typename U>
using type = U;
};

template<typename T>
struct test {
using type = wrap<T>::template type<T>;
};

I get the following errors from a gcc built around Dec 10, 2011:

main.cpp:9:10: error: expected nested-name-specifier before 'type'
main.cpp:9:10: error: using-declaration for non-member at class scope
main.cpp:9:15: error: expected ';' before '=' token
main.cpp:9:15: error: expected unqualified-id before '=' token

This idiom seems important for supporting C++11 allocators, which supply just
such a dependent alias.

Version info from my GCC build (running on Mac OS/X 10.7.2)
Using built-in specs.
COLLECT_GCC=g++-mp-4.7
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin11/4.7.0/lto-wrapper
Target: x86_64-apple-darwin11
Configured with: ../gcc-4.7-20111210/configure --prefix=/opt/local
--build=x86_64-apple-darwin11 --enable-languages=c,c++,objc,obj-c++
--libdir=/opt/local/lib/gcc47 --includedir=/opt/local/include/gcc47
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datarootdir=/opt/local/share/gcc-4.7 --with-local-prefix=/opt/local
--with-system-zlib --disable-nls --program-suffix=-mp-4.7
--with-gxx-include-dir=/opt/local/include/gcc47/c++/ --with-gmp=/opt/local
--with-mpfr=/opt/local --with-mpc=/opt/local --enable-stage1-checking
--disable-multilib
Thread model: posix
gcc version 4.7.0 20111210 (experimental) (GCC)


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

* [Bug c++/51593] alias templates fail in dependent contexts requiring ::template
  2011-12-16 22:49 [Bug c++/51593] New: alias templates fail in dependent contexts requiring ::template public at alisdairm dot net
@ 2011-12-16 22:55 ` pinskia at gcc dot gnu.org
  2011-12-16 23:32 ` public at alisdairm dot net
  2011-12-17  0:08 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-12-16 22:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-16 22:48:40 UTC ---
This works:
using type = typename wrap<T>::template type<T>;

Which seems correct as you need to say "wrap<T>::template type<T>" is a type.


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

* [Bug c++/51593] alias templates fail in dependent contexts requiring ::template
  2011-12-16 22:49 [Bug c++/51593] New: alias templates fail in dependent contexts requiring ::template public at alisdairm dot net
  2011-12-16 22:55 ` [Bug c++/51593] " pinskia at gcc dot gnu.org
@ 2011-12-16 23:32 ` public at alisdairm dot net
  2011-12-17  0:08 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: public at alisdairm dot net @ 2011-12-16 23:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Alisdair Meredith <public at alisdairm dot net> 2011-12-16 23:18:27 UTC ---
Thanks, I thought I had tried that, but I guess not.
It seems reasonable to close this as user error.


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

* [Bug c++/51593] alias templates fail in dependent contexts requiring ::template
  2011-12-16 22:49 [Bug c++/51593] New: alias templates fail in dependent contexts requiring ::template public at alisdairm dot net
  2011-12-16 22:55 ` [Bug c++/51593] " pinskia at gcc dot gnu.org
  2011-12-16 23:32 ` public at alisdairm dot net
@ 2011-12-17  0:08 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-17  0:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-16 23:45:47 UTC ---
Ok


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

end of thread, other threads:[~2011-12-16 23:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-16 22:49 [Bug c++/51593] New: alias templates fail in dependent contexts requiring ::template public at alisdairm dot net
2011-12-16 22:55 ` [Bug c++/51593] " pinskia at gcc dot gnu.org
2011-12-16 23:32 ` public at alisdairm dot net
2011-12-17  0:08 ` 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).