Skip to content

Commit 59eea5d

Browse files
committed
Fix two more diagnostics
1 parent c8e28a2 commit 59eea5d

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,8 @@ Improvements to Clang's diagnostics
505505
- ``-Wreserved-identifier`` now fires on reserved parameter names in a function
506506
declaration which is not a definition.
507507

508-
- The compatibility diagnostic for implicit ``typename`` before a dependent type
509-
name is now correctly part of ``-Wpre-c++20-compat`` rather than
510-
``-Wc++20-compat``. (#GH138775)
508+
- Several compatibility diagnostics that were incorrectly being grouped under
509+
``-Wpre-c++20-compat`` are now part of ``-Wc++20-compat``. (#GH138775)
511510

512511
Improvements to Clang's time-trace
513512
----------------------------------

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def err_enum_template : Error<"enumeration cannot be a template">;
132132

133133
def warn_cxx20_compat_consteval : Warning<
134134
"'consteval' specifier is incompatible with C++ standards before C++20">,
135-
InGroup<CXX20Compat>, DefaultIgnore;
135+
InGroup<CXXPre20Compat>, DefaultIgnore;
136136
def warn_missing_type_specifier : Warning<
137137
"type specifier missing, defaults to 'int'">,
138138
InGroup<ImplicitInt>, DefaultIgnore;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9568,7 +9568,7 @@ def err_incomplete_type_used_in_type_trait_expr : Error<
95689568
// C++20 constinit and require_constant_initialization attribute
95699569
def warn_cxx20_compat_constinit : Warning<
95709570
"'constinit' specifier is incompatible with C++ standards before C++20">,
9571-
InGroup<CXX20Compat>, DefaultIgnore;
9571+
InGroup<CXXPre20Compat>, DefaultIgnore;
95729572
def err_constinit_local_variable : Error<
95739573
"local variable cannot be declared 'constinit'">;
95749574
def err_require_constant_init_failed : Error<

clang/test/SemaCXX/gh138775.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=cxx17 %s
2-
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20 -Wpre-c++20-compat %s
2+
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=pre-cxx20-compat -Wpre-c++20-compat %s
3+
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20-compat -Wc++20-compat %s
4+
// cxx20-compat-no-diagnostics
35

4-
// cxx17-error@+3 {{unknown type name 'consteval'; did you mean 'constexpr'}}
5-
// cxx17-warning@+2 {{missing 'typename' prior to dependent type name 'T::type' is a C++20 extension}}
6-
// cxx20-warning@+1 {{missing 'typename' prior to dependent type name 'T::type' is incompatible with C++ standards before C++20}}
6+
// cxx17-error@+4 {{unknown type name 'consteval'; did you mean 'constexpr'}}
7+
// cxx17-warning@+3 {{missing 'typename' prior to dependent type name 'T::type' is a C++20 extension}}
8+
// pre-cxx20-compat-warning@+2 {{'consteval' specifier is incompatible with C++ standards before C++20}}
9+
// pre-cxx20-compat-warning@+1 {{missing 'typename' prior to dependent type name 'T::type' is incompatible with C++ standards before C++20}}
710
template<typename T> consteval T::type f();
11+
12+
// cxx17-error@+2 {{unknown type name 'constinit'}}
13+
// pre-cxx20-compat-warning@+1 {{'constinit' specifier is incompatible with C++ standards before C++20}}
14+
constinit int x = 4;

0 commit comments

Comments
 (0)