Skip to content

Commit

Permalink
Rename -Wc++20-designator to -Wc++2a-designator for consistency and add
Browse files Browse the repository at this point in the history
some test coverage for the flag.

llvm-svn: 370689
  • Loading branch information
zygoloid committed Sep 2, 2019
1 parent 34a38a3 commit ea36612
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions clang/include/clang/Basic/DiagnosticGroups.td
Expand Up @@ -146,9 +146,9 @@ def Deprecated : DiagGroup<"deprecated", [DeprecatedAttributes,
DeprecatedWritableStr]>,
DiagCategory<"Deprecations">;

def CXX2aDesignator : DiagGroup<"c++20-designator">;
def CXX2aDesignator : DiagGroup<"c++2a-designator">;
// Allow -Wno-c99-designator to be used to turn off all warnings on valid C99
// designators (including the warning controlled by -Wc++20-designator).
// designators (including the warning controlled by -Wc++2a-designator).
def C99Designator : DiagGroup<"c99-designator", [CXX2aDesignator]>;
def GNUDesignator : DiagGroup<"gnu-designator">;

Expand Down
19 changes: 10 additions & 9 deletions clang/test/SemaCXX/cxx2a-initializer-aggregates.cpp
@@ -1,17 +1,18 @@
// RUN: %clang_cc1 -std=c++2a %s -verify=expected,pedantic,override,reorder -pedantic-errors
// RUN: %clang_cc1 -std=c++2a %s -verify=expected,pedantic -Werror=c99-designator -Wno-reorder-init-list -Wno-initializer-overrides
// RUN: %clang_cc1 -std=c++2a %s -verify=expected,reorder -Wno-c99-designator -Werror=reorder-init-list -Wno-initializer-overrides
// RUN: %clang_cc1 -std=c++2a %s -verify=expected,override -Wno-c99-designator -Wno-reorder-init-list -Werror=initializer-overrides
// RUN: %clang_cc1 -std=c++2a %s -verify -Wno-c99-designator -Wno-reorder-init-list -Wno-initializer-overrides
// RUN: %clang_cc1 -std=c++2a %s -verify=cxx20,expected,pedantic,override,reorder -pedantic-errors
// RUN: %clang_cc1 -std=c++17 %s -verify=expected,pedantic,override,reorder -Wno-c++2a-designator -pedantic-errors
// RUN: %clang_cc1 -std=c++2a %s -verify=cxx20,expected,pedantic -Werror=c99-designator -Wno-reorder-init-list -Wno-initializer-overrides
// RUN: %clang_cc1 -std=c++2a %s -verify=cxx20,expected,reorder -Wno-c99-designator -Werror=reorder-init-list -Wno-initializer-overrides
// RUN: %clang_cc1 -std=c++2a %s -verify=cxx20,expected,override -Wno-c99-designator -Wno-reorder-init-list -Werror=initializer-overrides
// RUN: %clang_cc1 -std=c++2a %s -verify=cxx20,expected -Wno-c99-designator -Wno-reorder-init-list -Wno-initializer-overrides


namespace class_with_ctor {
struct A { // expected-note 6{{candidate}}
A() = default; // expected-note 3{{candidate}}
struct A { // cxx20-note 6{{candidate}}
A() = default; // cxx20-note 3{{candidate}}
int x;
int y;
};
A a = {1, 2}; // expected-error {{no matching constructor}}
A a = {1, 2}; // cxx20-error {{no matching constructor}}

struct B {
int x;
Expand All @@ -24,7 +25,7 @@ namespace class_with_ctor {
A a;
};
C c1 = {{}, {}}; // ok, call default ctor twice
C c2 = {{1, 2}, {3, 4}}; // expected-error 2{{no matching constructor}}
C c2 = {{1, 2}, {3, 4}}; // cxx20-error 2{{no matching constructor}}
}

namespace designator {
Expand Down

0 comments on commit ea36612

Please sign in to comment.