Bug 288439 - Parser does not understand function pointer type with variadic templated types as parameters
Summary: Parser does not understand function pointer type with variadic templated type...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Unclassified
Component: Language Support: CPP (old) (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: 4.2.3
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 286208 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-12-07 20:16 UTC by Griwes
Modified: 2013-01-28 01:03 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Griwes 2011-12-07 20:16:43 UTC
Version:           git master (using KDE 4.7.2) 
OS:                Linux

In C++11, there were added variadic templates. Support for them is, from what I've already seen, very nice in KDevelop, however there is one really annoying problem. It does not properly parse the code snippet from StR.

Reproducible: Always

Steps to Reproduce:
template<typename ret, typename... Args>
class Function<ret (*)(Args...)>
{
};


Actual Results:  
Unexpected token: '<'
Unexpected token: '*'
Unexpected token: ellipsis

Expected Results:  
Correct parse results.
Comment 1 Blagovest Zlatev 2011-12-08 15:24:53 UTC
The bug is reproducible and not duplicated.
Comment 2 Myriam Schweingruber 2011-12-12 08:43:07 UTC
Blagovest: you have already seen that in another bug :)

*** This bug has been marked as a duplicate of bug 288251 ***
Comment 3 Griwes 2011-12-12 22:33:40 UTC
Hello, how come that bug about variadic function pointer types is the same as bug about variadic macros...?
Comment 4 Milian Wolff 2011-12-13 12:19:43 UTC
this is not a duplicate
Comment 5 Gábor Lehel 2013-01-20 15:40:17 UTC
The problem here is that the argument list is left unnamed. If I give it a name:

template<typename ret, typename... Args>
class Function<ret (*)(Args... name_of_args)>
{
};

then it parses fine.

The same problem manifests in many different contexts: if I omit a name following an ellipsis, it gets underlined in red and looks unpleasant, if I add a name, it's nice and colorful.

Some more examples:

template<typename... Ts, typename Obj>
void foo(Obj* obj, void (Obj::*method)(Ts...));

template<typename... Ts>
void bar(Foo<Ts>...);

template<typename, int...>
struct Blah;
Comment 6 Milian Wolff 2013-01-28 00:27:48 UTC
*** Bug 286208 has been marked as a duplicate of this bug. ***
Comment 7 Milian Wolff 2013-01-28 01:03:29 UTC
Git commit 923bbcbd9b6306500b178b297977cb4199cef5a0 by Milian Wolff.
Committed on 28/01/2013 at 02:01.
Pushed by mwolff into branch '4.5'.

C++11: Support abstract declarator only containing an ellipsis.

Such parameter pack expansion can be unnamed and that often occurs
for e.g. function pointers or similar.

M  +6    -0    languages/cpp/parser/parser.cpp
M  +7    -1    languages/cpp/parser/tests/test_parser_cpp2011.cpp

http://commits.kde.org/kdevelop/923bbcbd9b6306500b178b297977cb4199cef5a0