xref: /llvm-project/clang/test/SemaCXX/warn-unsequenced-paren-list-init.cpp (revision 4ce737bfd6fd0aafb436eb220c3e724bfc831db4)
1 // RUN: %clang_cc1 -fsyntax-only -std=c++20 -Wno-unused -Wunsequenced -verify %s
2 
3 struct A {
4   int x, y;
5 };
6 
test()7 void test() {
8   int a = 0;
9 
10   A agg1( a++, a++ ); // no warning
11   A agg2( a++ + a, a++ ); // expected-warning {{unsequenced modification and access to 'a'}}
12 
13   int arr1[]( a++, a++ ); // no warning
14   int arr2[]( a++ + a, a++ ); // expected-warning {{unsequenced modification and access to 'a'}}
15 }
16