[cfe-commits] r150317 - in /cfe/trunk: include/clang/Sema/Initialization.h lib/Parse/ParseDecl.cpp test/Parser/cxx-default-delete.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Sat Feb 11 15:51:22 PST 2012


Author: cornedbee
Date: Sat Feb 11 17:51:21 2012
New Revision: 150317

URL: http://llvm.org/viewvc/llvm-project?rev=150317&view=rev
Log:
Drive-by fix of incorrect diagnostic, and a test case for said diagnostic. The double error is unfortunate, but I really don't see an alternative whose effort is worth it.

Modified:
    cfe/trunk/include/clang/Sema/Initialization.h
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/test/Parser/cxx-default-delete.cpp

Modified: cfe/trunk/include/clang/Sema/Initialization.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Initialization.h?rev=150317&r1=150316&r2=150317&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Initialization.h (original)
+++ cfe/trunk/include/clang/Sema/Initialization.h Sat Feb 11 17:51:21 2012
@@ -1,4 +1,4 @@
-//===--- SemaInit.h - Semantic Analysis for Initializers --------*- C++ -*-===//
+//===--- Initialization.h - Semantic Analysis for Initializers --*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=150317&r1=150316&r2=150317&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Sat Feb 11 17:51:21 2012
@@ -1282,8 +1282,8 @@
         Diag(ConsumeToken(), diag::err_deleted_non_function);
     } else if (Tok.is(tok::kw_default)) {
       if (D.isFunctionDeclarator())
-        Diag(Tok, diag::err_default_delete_in_multiple_declaration)
-          << 1 /* delete */;
+        Diag(ConsumeToken(), diag::err_default_delete_in_multiple_declaration)
+          << 0 /* default */;
       else
         Diag(ConsumeToken(), diag::err_default_special_members);
     } else {

Modified: cfe/trunk/test/Parser/cxx-default-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-default-delete.cpp?rev=150317&r1=150316&r2=150317&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-default-delete.cpp (original)
+++ cfe/trunk/test/Parser/cxx-default-delete.cpp Sat Feb 11 17:51:21 2012
@@ -3,8 +3,12 @@
 int i = delete; // expected-error{{only functions}}
 int j = default; // expected-error{{special member functions}}
 
-int f() = delete, g; // expected-error{{standalone}}
-int o, p() = delete; // expected-error{{standalone}}
+int f() = delete, g; // expected-error{{'= delete' is a function definition}}
+int o, p() = delete; // expected-error{{'= delete' is a function definition}}
+
+int q() = default, r; // expected-error{{only special member functions}} \
+                      // expected-error{{'= default' is a function definition}}
+int s, t() = default; // expected-error{{'= default' is a function definition}}
 
 struct foo {
   foo() = default;





More information about the cfe-commits mailing list