-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clang][P1061] Add proper C++ compatability warnings
- Loading branch information
1 parent
5751d2f
commit 36f8029
Showing
3 changed files
with
13 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -std=c++26 %s -verify=nontemplate | ||
// RUN: %clang_cc1 -fsyntax-only %s -verify=nontemplate,compat | ||
// RUN: %clang_cc1 -std=c++26 -fsyntax-only %s -verify=nontemplate | ||
// RUN: %clang_cc1 -std=c++2c -verify=cxx26,nontemplate -fsyntax-only -Wpre-c++26-compat %s | ||
// RUN: %clang_cc1 -std=c++23 -verify=cxx23,nontemplate -fsyntax-only -Wc++26-extensions %s | ||
|
||
void decompose_array() { | ||
int arr[4] = {1, 2, 3, 6}; | ||
auto [x, ...rest, y] = arr; // nontemplate-error{{pack declaration outside of template}} \ | ||
// compat-warning{{structured binding pack is incompatible with C++ standards before C++2c}} | ||
// cxx26-warning@+3 {{structured binding packs are incompatible with C++ standards before C++2c}} | ||
// cxx23-warning@+2 {{structured binding packs are a C++2c extension}} | ||
// nontemplate-error@+1 {{pack declaration outside of template}} | ||
auto [x, ...rest, y] = arr; | ||
} |