1 // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -std=c++11 %s 2>&1 | FileCheck %s
3 template<typename T
, typename U
>
6 template<typename T
, typename U
>
8 typedef pair
<T
,U
> *iterator
;
13 template<typename T
, typename U
>
14 pair
<T
,U
> &tie(T
&, U
&);
16 int foo(map
<char*,int> &m
) {
20 for (pair
<char*,int> x
: m
) {
24 for (tie(p
, n
) : m
) { // expected-error {{for range declaration must declare a variable}}
36 iterator
&operator++();
37 iterator
&operator++(int);
38 bool operator==(const iterator
&) const;
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}:":"
52 v
) // expected-error@-1 {{range-based 'for' statement uses ':', not '='}}
53 // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:7-[[@LINE-2]]:8}:":"
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 '='}}