[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Parser / cxx0x-for-range.cpp
blobc3276ebeaabbcd1769ced2672b424392c331c553
1 // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -std=c++11 %s 2>&1 | FileCheck %s
3 template<typename T, typename U>
4 struct pair {};
6 template<typename T, typename U>
7 struct map {
8 typedef pair<T,U> *iterator;
9 iterator begin();
10 iterator end();
13 template<typename T, typename U>
14 pair<T,U> &tie(T &, U &);
16 int foo(map<char*,int> &m) {
17 char *p;
18 int n;
20 for (pair<char*,int> x : m) {
21 (void)x;
24 for (tie(p, n) : m) { // expected-error {{for range declaration must declare a variable}}
25 (void)p;
26 (void)n;
29 return n;
32 namespace PR19176 {
33 struct Vector {
34 struct iterator {
35 int &operator*();
36 iterator &operator++();
37 iterator &operator++(int);
38 bool operator==(const iterator &) const;
40 iterator begin();
41 iterator end();
44 void f() {
45 Vector v;
46 int a[] = {1, 2, 3, 4};
47 for (auto foo = a) // expected-error {{range-based 'for' statement uses ':', not '='}}
48 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:19-[[@LINE-1]]:20}:":"
49 (void)foo;
50 for (auto i
52 v) // expected-error@-1 {{range-based 'for' statement uses ':', not '='}}
53 // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:7-[[@LINE-2]]:8}:":"
54 (void)i;
55 #define FORRANGE(v, a) for (DECLVARWITHINIT(v) a) // expected-note {{expanded from macro}}
56 #define DECLAUTOVAR(v) auto v
57 #define DECLVARWITHINIT(v) DECLAUTOVAR(v) = // expected-note {{expanded from macro}}
58 FORRANGE(i, a) { // expected-error {{range-based 'for' statement uses ':', not '='}}