From: Douglas Gregor Date: Wed, 17 Dec 2008 16:19:15 +0000 (+0000) Subject: Removed the warning X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3eb1c546857087b5e1377d172f37868ade960664;p=clang Removed the warning warning: statement was disambiguated as declaration because it is currently firing in cases where the declaration would not actually parse as a statement. We'd love to bring this warning back if we can make it more accurate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61137 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index 42ce6c7a9f..7beac265f7 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -597,8 +597,6 @@ DIAG(err_expected_lparen_after_type, ERROR, "expected '(' for function-style cast or type construction") DIAG(err_expected_equal_after_declarator, ERROR, "expected '=' after declarator") -DIAG(warn_statement_disambiguation, WARNING, - "statement was disambiguated as %0") DIAG(warn_parens_disambiguated_as_function_decl, WARNING, "parentheses were disambiguated as a function declarator") DIAG(err_expected_member_or_base_name, ERROR, diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp index 3c50884c9c..f352efa872 100644 --- a/lib/Parse/ParseTentative.cpp +++ b/lib/Parse/ParseTentative.cpp @@ -126,18 +126,6 @@ bool Parser::isCXXSimpleDeclaration() { TPR = TPResult::True(); assert(TPR == TPResult::True() || TPR == TPResult::False()); - if (TPR == TPResult::True() && Tok.isNot(tok::kw_void)) { - // We have a declaration that looks like a functional cast; there's a high - // chance that the author intended the statement to be an expression. - // Emit a warning. - Diag(Tok, diag::warn_statement_disambiguation) - << "declaration" << SourceRange(Tok.getLocation(), TentativeParseLoc); - } else if (TPR == TPResult::False() && Tok.is(tok::kw_void)) { - // A functional cast to 'void' expression ? Warning.. - Diag(Tok, diag::warn_statement_disambiguation) - << "expression" << SourceRange(Tok.getLocation(), TentativeParseLoc); - } - return TPR == TPResult::True(); } diff --git a/test/SemaCXX/const-cast.cpp b/test/SemaCXX/const-cast.cpp index bc3908fd5d..03a0e908eb 100644 --- a/test/SemaCXX/const-cast.cpp +++ b/test/SemaCXX/const-cast.cpp @@ -27,7 +27,7 @@ char ***good_const_cast_test(ccvpcvpp var) // Drop reference. Intentionally without qualifier change. char *** var5 = const_cast(var4); const int ar[100] = {0}; - int (&rar)[100] = const_cast(ar); // expected-warning {{statement was disambiguated as declaration}} expected-error {{const_cast from 'int const [100]' to 'iarr' is not allowed}} + int (&rar)[100] = const_cast(ar); // expected-error {{const_cast from 'int const [100]' to 'iarr' is not allowed}} // Array decay. Intentionally without qualifier change. int *pi = const_cast(ar); f fp = 0; diff --git a/test/SemaCXX/decl-expr-ambiguity.cpp b/test/SemaCXX/decl-expr-ambiguity.cpp index 7d12e22329..db845393cd 100644 --- a/test/SemaCXX/decl-expr-ambiguity.cpp +++ b/test/SemaCXX/decl-expr-ambiguity.cpp @@ -10,7 +10,7 @@ void f() { int(a)++; // expected-error {{expression is not assignable}} __extension__ int(a)++; // expected-error {{expression is not assignable}} typeof(int)(a,5)<