зеркало из https://github.com/microsoft/clang.git
Change warning about incomplete parsing of C++ default arg to error and provide a test case; thanks Doug!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110603 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d91de2bc0e
Коммит
219cffcad3
|
@ -271,8 +271,8 @@ def err_destructor_tilde_identifier : Error<
|
|||
"expected a class name after '~' to name a destructor">;
|
||||
def err_destructor_template_id : Error<
|
||||
"destructor name %0 does not refer to a template">;
|
||||
def warn_default_arg_unparsed : Warning<
|
||||
"parsing of default argument is incomplete">;
|
||||
def err_default_arg_unparsed : Error<
|
||||
"unexpected end of default argument expression">;
|
||||
|
||||
// C++ derived classes
|
||||
def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;
|
||||
|
|
|
@ -145,12 +145,8 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
|
|||
else {
|
||||
if (Tok.is(tok::cxx_defaultarg_end))
|
||||
ConsumeToken();
|
||||
else {
|
||||
// Warn that there are tokens from the default arg that we left
|
||||
// unparsed. This actually indicates a bug in clang but we avoid
|
||||
// asserting because we want the parser robust.
|
||||
Diag(Tok.getLocation(), diag::warn_default_arg_unparsed);
|
||||
}
|
||||
else
|
||||
Diag(Tok.getLocation(), diag::err_default_arg_unparsed);
|
||||
Actions.ActOnParamDefaultArgument(LM.DefaultArgs[I].Param, EqualLoc,
|
||||
move(DefArgResult));
|
||||
}
|
||||
|
|
|
@ -10,3 +10,7 @@ class C {
|
|||
typedef struct Inst {
|
||||
void m(int x=0);
|
||||
} *InstPtr;
|
||||
|
||||
struct X {
|
||||
void f(int x = 1:); // expected-error {{unexpected end of default argument expression}}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче