Clang Project

clang_source_code/test/CXX/drs/dr22xx.cpp
1// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
2// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
3// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
4// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
5
6namespace dr2229 { // dr2229: 7
7struct AnonBitfieldQualifiers {
8  const unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
9  volatile unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
10  const volatile unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
11
12  unsigned : 1;
13  const unsigned i1 : 1;
14  volatile unsigned i2 : 1;
15  const volatile unsigned i3 : 1;
16};
17}
18
19#if __cplusplus >= 201103L
20namespace dr2211 { // dr2211: 8
21void f() {
22  int a;
23  auto f = [a](int a) { (void)a; }; // expected-error {{a lambda parameter cannot shadow an explicitly captured entity}}
24  // expected-note@-1{{variable 'a' is explicitly captured here}}
25  auto g = [=](int a) { (void)a; };
26}
27}
28#endif
29