Bug 310472 - C++11: ref qualifiers not recognized on non-static member functions (class.mfct.non-static p5)
Summary: C++11: ref qualifiers not recognized on non-static member functions (class.mf...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: 4.4.1
Platform: Fedora RPMs Linux
: NOR wishlist
Target Milestone: 4.3.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-22 01:04 UTC by John
Modified: 2013-01-09 09:01 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 John 2012-11-22 01:04:29 UTC
In C++11 non static member functions now support reference qualifiers. For the un-initiated they go after the function declaration/definition and can be combined with const and/or volatile. Just like the const and volatile qualifiers they allow overloading the function on the type of the implicit object parameter ("this").

struct foo {
	foo();
	void bar() & ; //1. Lvalue reference qualifier
	void bar() &&; //2. Rvalue reference qualifier
};

void myfunc() {
	foo f;
	f.bar(); //Calls 1 since the implicit object parameter is an lvalue
	foo().bar(); //Calls 2 since the implicit object parameter is an rvalue
}

1 and 2 are treated as syntax errors by KDevelop and as an obvious side effect completion for those functions is not available either.

Reproducible: Always

Steps to Reproduce:
1. Enter the example provided into a C++ file 
2. Compile as C++11 (currently clang 3.1 is the only compiler i have that understands this)
Actual Results:  
KDevelop flags a syntax error even though it is valid C++11 and successfully compiles.

Expected Results:  
KDevelop should accept the syntax and understand it for the purpose of completion although simply accepting it as valid syntax but acting as if the reference qualifiers are not present would be a great start since then completion could presumably work even if filtering out completions by context wouldn't.
Comment 1 Milian Wolff 2013-01-08 20:35:52 UTC
Git commit 4f7dc5113be5967d84cad1fcd5effc7e65c8a824 by Milian Wolff.
Committed on 08/01/2013 at 01:07.
Pushed by mwolff into branch 'master'.

Properly parse C++11 reference bindings.

These are ignored in the semantic analysis for now but at least this
way code completion does not break and no annoying errors are shown.

M  +2    -0    languages/cpp/parser/ast.h
M  +13   -1    languages/cpp/parser/parser.cpp
M  +1    -0    languages/cpp/parser/parser.h
M  +1    -0    languages/cpp/parser/tests/test_parser.h
M  +11   -0    languages/cpp/parser/tests/test_parser_cpp2011.cpp

http://commits.kde.org/kdevelop/4f7dc5113be5967d84cad1fcd5effc7e65c8a824
Comment 2 Gábor Lehel 2013-01-09 09:01:20 UTC
Yay, thank you. Building from master once I get home...