Implement a warning flag for the warning about default arguments making

special member functions.

llvm-svn: 132564
This commit is contained in:
Alexis Hunt 2011-06-03 17:55:52 +00:00
parent 0bb0df5839
commit ea31988f63
3 changed files with 5 additions and 2 deletions

View File

@ -33,6 +33,7 @@ def : DiagGroup<"char-align">;
def Comment : DiagGroup<"comment">;
def : DiagGroup<"ctor-dtor-privacy">;
def : DiagGroup<"declaration-after-statement">;
def DefaultArgSpecialMember : DiagGroup<"default-arg-special-member">;
def GNUDesignator : DiagGroup<"gnu-designator">;
def DeleteNonVirtualDtor : DiagGroup<"delete-non-virtual-dtor">;

View File

@ -1416,11 +1416,12 @@ def err_uninitialized_member_in_ctor : Error<
"the %select{reference|const}2 member %3">;
def warn_default_arg_makes_ctor_special : Warning<
"addition of default argument on redeclaration makes this constructor a "
"%select{default|copy|move}0 constructor">;
"%select{default|copy|move}0 constructor">, InGroup<DefaultArgSpecialMember>;
def note_previous_declaration_special : Note<
// The ERRORs are in hopes that if they occur, they'll get reported.
"previous declaration was %select{*ERROR*|a copy constructor|a move "
"constructor|*ERROR*|*ERROR*|*ERROR*|not a special member function}0">;
"constructor|*ERROR*|*ERROR*|*ERROR*|not a special member function}0">,
InGroup<DefaultArgSpecialMember>;
def err_use_of_default_argument_to_function_declared_later : Error<
"use of default argument to function %0 that is declared later in class %1">;

View File

@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUM: %clang_cc1 -Wno-default-arg-special-member -Werror -fsyntax-only %s
class foo {
foo(foo&, int); // expected-note {{was not a special member function}}