clang/test/SemaCXX/warn-unsequenced-paren-list-init.cpp
raw| 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++20 -Wno-unused -Wunsequenced -verify %s |
| 2 | |
| 3 | struct A { |
| 4 | int x, y; |
| 5 | }; |
| 6 | |
| 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 | } |