Bug 51139 - c++11 alias-declarations doasn't work contrary to relase notes
Summary: c++11 alias-declarations doasn't work contrary to relase notes
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-15 11:14 UTC by Sven Passig
Modified: 2011-11-15 12:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Passig 2011-11-15 11:14:20 UTC
According to the 4.7 release notes (http://gcc.gnu.org/gcc-4.7/changes.html) the C++11 feature "alias-declarations" should work.

However I was not able to compile the example given in the release notes above:

-------------------------------------
template <class T> using Ptr = T*;
Ptr<int> ip;  // decltype(ip) is int*
-------------------------------------

I get this error:

---------------------------------------------
error: expected unqualified-id before 'using'
error: 'Ptr' does not name a type
---------------------------------------------

I tried the other C++11 examples like 

--------------------------------------------------------------------------------
constexpr long double operator"" _degrees (long double d) { return d * 0.0175; }
long double pi = 180_degrees;
--------------------------------------------------------------------------------

and 

-----------------------------
struct A {
  int i = 42;
} a; // initializes a.i to 42
-----------------------------

which all work fine.

This is the output of the version information:

-----------------------------------
/opt/gcc-4.7/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/opt/gcc-4.7/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc-4.7/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/opt/gcc-4.7 --enable-languages=c,c++ --enable-threads=posix --enable-tls --enable-libgomp --enable-lto --disable-nls --disable-checking --disable-multilib --disable-bootstrap
Thread model: posix
gcc version 4.7.0 20111105 (experimental) (GCC) 
------------------------------------

It's an ubuntu system (11.10 64Bit). I compiled the gcc from the then newest snapshot.
Comment 1 Jonathan Wakely 2011-11-15 11:32:21 UTC
it was only implemented on the 7th, your compiler is too old

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45114#c13
Comment 2 Jonathan Wakely 2011-11-15 11:33:52 UTC
and severity is never "critical" for a brand new feature (in the C++11 mode still labelled experimental) in an unreleased compiler
Comment 3 Sven Passig 2011-11-15 11:36:53 UTC
(In reply to comment #2)
> and severity is never "critical" for a brand new feature (in the C++11 mode
> still labelled experimental) in an unreleased compiler

ah ok, thanks for clarifying
Comment 4 Sven Passig 2011-11-15 11:42:45 UTC
(In reply to comment #1)
> it was only implemented on the 7th, your compiler is too old
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45114#c13

Thanks for this ultrafast answer on this.

I tried to figure out this by myself but my svn client is still downloading the subversion log for commit commends (there seams to be no online source of the commit log).
Comment 5 Jonathan Wakely 2011-11-15 12:40:22 UTC
All commits are sent to http://gcc.gnu.org/ml/gcc-cvs/

Or you can look at http://gcc.gnu.org/viewcvs/ at the ChangeLog files.

e.g. for the C++ front end:
http://gcc.gnu.org/viewcvs/trunk/gcc/cp/ChangeLog
(although sometimes fetching that page times out because there are a LOT of revisions to that file)
Comment 6 Sven Passig 2011-11-15 12:44:45 UTC
(In reply to comment #5)
> http://gcc.gnu.org/viewcvs/trunk/gcc/cp/ChangeLog
> (although sometimes fetching that page times out because there are a LOT of
> revisions to that file)

thanks a lot again, this is a great ressource. It was very easy to find the "alias-declaration" entry and the further changes on this feature.