diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -382,6 +382,8 @@ def PrivateModule : DiagGroup<"private-module">; def CXX11InlineNamespace : DiagGroup<"c++11-inline-namespace">; +def InlineNamespaceReopenedNoninline + : DiagGroup<"inline-namespace-reopened-noninline">; def InvalidNoreturn : DiagGroup<"invalid-noreturn">; def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">; def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">; diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -1414,7 +1414,8 @@ DefaultIgnore, InGroup; def warn_inline_namespace_reopened_noninline : Warning< - "inline namespace reopened as a non-inline namespace">; + "inline namespace reopened as a non-inline namespace">, + InGroup; def err_inline_namespace_mismatch : Error< "non-inline namespace cannot be reopened as inline">; diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c --- a/clang/test/Misc/warning-flags.c +++ b/clang/test/Misc/warning-flags.c @@ -18,7 +18,7 @@ The list of warnings below should NEVER grow. It should gradually shrink to 0. -CHECK: Warnings without flags (69): +CHECK: Warnings without flags (68): CHECK-NEXT: ext_expected_semi_decl_list CHECK-NEXT: ext_explicit_specialization_storage_class @@ -58,7 +58,6 @@ CHECK-NEXT: warn_ignoring_ftabstop_value CHECK-NEXT: warn_implements_nscopying CHECK-NEXT: warn_incompatible_qualified_id -CHECK-NEXT: warn_inline_namespace_reopened_noninline CHECK-NEXT: warn_invalid_asm_cast_lvalue CHECK-NEXT: warn_maynot_respond CHECK-NEXT: warn_method_param_redefinition diff --git a/clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp b/clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp new file mode 100644 --- /dev/null +++ b/clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -Wall -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -Wall -Wno-inline-namespace-reopened-noninline -DSILENCE -verify -std=c++11 %s + +namespace X { + #ifndef SILENCE + inline namespace {} // expected-note {{previous definition}} + namespace {} // expected-warning {{inline namespace reopened as a non-inline namespace}} + #else + // expected-no-diagnostics + inline namespace {} + namespace {} + #endif +}