From ea31988f63b7a34b3aeefa60dbf9bb5fbd843e96 Mon Sep 17 00:00:00 2001 From: Alexis Hunt Date: Fri, 3 Jun 2011 17:55:52 +0000 Subject: [PATCH] Implement a warning flag for the warning about default arguments making special member functions. llvm-svn: 132564 --- clang/include/clang/Basic/DiagnosticGroups.td | 1 + clang/include/clang/Basic/DiagnosticSemaKinds.td | 5 +++-- clang/test/SemaCXX/default-arg-special-member.cpp | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index cad4b5ef6ac1..9abd6d3c5769 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/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/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 33c3445d51dc..95f455f6e4d8 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/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/clang/test/SemaCXX/default-arg-special-member.cpp b/clang/test/SemaCXX/default-arg-special-member.cpp index aadbbeb2fcd7..015ea3d7f70d 100644 --- a/clang/test/SemaCXX/default-arg-special-member.cpp +++ b/clang/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}}