forked from qt-creator/qt-creator
CPlusPlus: Allow " = default" also on function implementations
Note that we only make sure not to trip over valid code; we make no effort to check whether default/delete is actually allowed at this type of declaration. Fixes: QTCREATORBUG-28102 Change-Id: Ic693319b9dfaf8652cf4cae9cd907a6e258ad773 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
2
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
2
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -2798,7 +2798,7 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_sp
|
||||
return true;
|
||||
}
|
||||
rewind(colon_token);
|
||||
} else if (isFunctionDeclarator && declaringClass && node->core_declarator && LA() == T_EQUAL && LA(3) == T_SEMICOLON) { // = 0, = delete, = default
|
||||
} else if (isFunctionDeclarator && node->core_declarator && LA() == T_EQUAL && LA(3) == T_SEMICOLON) { // = 0, = delete, = default
|
||||
if (!_languageFeatures.cxx11Enabled || LA(2) == T_NUMERIC_LITERAL) {
|
||||
parseInitializer(node->initializer, &node->equal_token);
|
||||
} else {
|
||||
|
@@ -1,8 +1,10 @@
|
||||
class C {
|
||||
C() = default;
|
||||
C();
|
||||
C(const C &) = delete;
|
||||
C &operator=(const C &) = default;
|
||||
|
||||
void foo() = delete;
|
||||
template <class T> void bar(T) = delete;
|
||||
};
|
||||
|
||||
C::C() = default;
|
||||
|
Reference in New Issue
Block a user