Parse deleted member functions. Parsing member declarations goes through a different code path that I forgot previously.
Implement the rvalue reference overload dance for returning local objects. Returning a local object first tries to find a move constructor now.
The error message when no move constructor is defined (or is not applicable) and the copy constructor is deleted is quite ugly, though.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68902 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index bef1fb7..91c0566 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -668,7 +668,7 @@
/// declarator constant-initializer[opt]
/// identifier[opt] ':' constant-expression
///
-/// pure-specifier: [TODO]
+/// pure-specifier:
/// '= 0'
///
/// constant-initializer:
@@ -767,6 +767,7 @@
llvm::SmallVector<DeclPtrTy, 8> DeclsInGroup;
OwningExprResult BitfieldSize(Actions);
OwningExprResult Init(Actions);
+ bool Deleted = false;
while (1) {
@@ -787,12 +788,21 @@
//
// constant-initializer:
// '=' constant-expression
+ //
+ // defaulted/deleted function-definition:
+ // '=' 'default' [TODO]
+ // '=' 'delete'
if (Tok.is(tok::equal)) {
ConsumeToken();
- Init = ParseInitializer();
- if (Init.isInvalid())
- SkipUntil(tok::comma, true, true);
+ if (getLang().CPlusPlus0x && Tok.is(tok::kw_delete)) {
+ ConsumeToken();
+ Deleted = true;
+ } else {
+ Init = ParseInitializer();
+ if (Init.isInvalid())
+ SkipUntil(tok::comma, true, true);
+ }
}
// If attributes exist after the declarator, parse them.
@@ -808,7 +818,8 @@
DeclPtrTy ThisDecl = Actions.ActOnCXXMemberDeclarator(CurScope, AS,
DeclaratorInfo,
BitfieldSize.release(),
- Init.release());
+ Init.release(),
+ Deleted);
if (ThisDecl)
DeclsInGroup.push_back(ThisDecl);
@@ -858,6 +869,7 @@
DeclaratorInfo.clear();
BitfieldSize = 0;
Init = 0;
+ Deleted = false;
// Attributes are only allowed on the second declarator.
if (Tok.is(tok::kw___attribute)) {