aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaCXX/warn-unsequenced-paren-list-init.cpp
blob: 5aeeb45f81e226c311f0159d419f88c70b8aef18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: %clang_cc1 -fsyntax-only -std=c++20 -Wno-unused -Wunsequenced -verify %s

struct A {
  int x, y;
};

void test() {
  int a = 0;

  A agg1( a++, a++ ); // no warning
  A agg2( a++ + a, a++ ); // expected-warning {{unsequenced modification and access to 'a'}}

  int arr1[]( a++, a++ ); // no warning
  int arr2[]( a++ + a, a++ ); // expected-warning {{unsequenced modification and access to 'a'}}
}