From: Sean Hunt Date: Fri, 3 Jun 2011 17:55:52 +0000 (+0000) Subject: Implement a warning flag for the warning about default arguments making X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78e9c55c9acc85d82f4dd53a49c05310b4b56a1b;p=clang Implement a warning flag for the warning about default arguments making special member functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132564 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index cad4b5ef6a..9abd6d3c57 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -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">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 33c3445d51..95f455f6e4 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -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; 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; 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">; diff --git a/test/SemaCXX/default-arg-special-member.cpp b/test/SemaCXX/default-arg-special-member.cpp index aadbbeb2fc..015ea3d7f7 100644 --- a/test/SemaCXX/default-arg-special-member.cpp +++ b/test/SemaCXX/default-arg-special-member.cpp @@ -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}}