Bug 294536 - C++11: missing support for templated alias-declarations
Summary: C++11: missing support for templated alias-declarations
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: git master
Platform: Unlisted Binaries Linux
: HI normal
Target Milestone: 4.2.3
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-20 23:38 UTC by Audrius
Modified: 2013-03-31 00:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Audrius 2012-02-20 23:38:06 UTC
Version:           git master (using KDE 4.7.4) 
OS:                Linux

This code is legal in C++1x:
class Foo;
using Bar = Foo;

Reproducible: Always

Steps to Reproduce:
Code that fails to parse:
class Foo;
using Bar = Foo;

Actual Results:  
Excpected token ';' after 'identifier' found '='
Excpected token ';' after 'identifier' found '='
Unexpected token 'using'
Unexpected token '='

Expected Results:  
The code should parse without errors.
Comment 1 Milian Wolff 2012-02-21 09:11:31 UTC
confirmed, thanks
Comment 2 Milian Wolff 2012-02-21 09:37:31 UTC
just asking: gcc 4.6 also doesn't support this syntax yet, does it?
Comment 3 Milian Wolff 2012-02-21 10:28:33 UTC
Git commit 42e5828e95e60b4c3b0bb22de4fb24ee689f8ee5 by Milian Wolff.
Committed on 21/02/2012 at 10:52.
Pushed by mwolff into branch '4.3'.

c++11 support: add parser-support for alias-declaration

TODO: duchain integration

M  +11   -0    languages/cpp/parser/ast.h
M  +2    -1    languages/cpp/parser/dumptree.cpp
M  +24   -4    languages/cpp/parser/parser.cpp
M  +1    -0    languages/cpp/parser/tests/test_parser.h
M  +8    -0    languages/cpp/parser/tests/test_parser_cpp2011.cpp
M  +1    -0    languages/cpp/parser/visitor.cpp
M  +1    -0    languages/cpp/parser/visitor.h

http://commits.kde.org/kdevelop/42e5828e95e60b4c3b0bb22de4fb24ee689f8ee5
Comment 4 Milian Wolff 2012-02-21 10:28:33 UTC
Git commit 5c8072ce731abb32e06ce585e934c78ac27730c1 by Milian Wolff.
Committed on 21/02/2012 at 11:25.
Pushed by mwolff into branch '4.3'.

c++11 support: alias-declaration is not handled just like a typedef in the duchain

it's still missing support for template-aliases though

M  +11   -0    languages/cpp/cppduchain/declarationbuilder.cpp
M  +1    -0    languages/cpp/cppduchain/declarationbuilder.h
M  +1    -0    languages/cpp/cppduchain/tests/test_duchain.h
M  +35   -0    languages/cpp/cppduchain/tests/test_duchain_cpp2011.cpp
M  +6    -0    languages/cpp/parser/default_visitor.cpp
M  +1    -0    languages/cpp/parser/default_visitor.h

http://commits.kde.org/kdevelop/5c8072ce731abb32e06ce585e934c78ac27730c1
Comment 5 Audrius 2012-02-21 11:55:22 UTC
That was fast :D
As you might have guessed, only gcc 4.7 supports this new alias syntax.
Keep in mind, that using-alias declaration can be templated. E.g.

template <class A, class B, class C> struct T;
template <class B1> using T1 = T<int, B1, char>;
Comment 6 Milian Wolff 2012-02-21 13:56:12 UTC
right, see my last commit message ;-)
Comment 7 Olivier.jg 2012-10-26 21:30:47 UTC
Works now.
Comment 8 Aleix Pol 2013-03-31 00:50:51 UTC
Moving all the bugs from the CPP Parser. It was not well defined the difference between it and C++ Language Support and people kept reporting in both places indistinctively