diff options
| author | Ariel J. Bernal <ariel.j.bernal@intel.com> | 2013-05-09 17:46:20 +0000 |
|---|---|---|
| committer | Ariel J. Bernal <ariel.j.bernal@intel.com> | 2013-05-09 17:46:20 +0000 |
| commit | 3429028a811c1ce5e2ab1bb41f4af75c5ea7bf67 (patch) | |
| tree | dd196d06a75b60e864d766dae24d8a87c24f6225 /clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp | |
| parent | 0646c86dcb1a78c4bf218037939cbd7d0849254b (diff) | |
| download | bcm5719-llvm-3429028a811c1ce5e2ab1bb41f4af75c5ea7bf67.tar.gz bcm5719-llvm-3429028a811c1ce5e2ab1bb41f4af75c5ea7bf67.zip | |
Use 'auto const&' for iterators whose deref operator return a const var
This patch fixes PR15601.
- Added check for whether the loop variable and the initializer have the same
type.
- Added tests.
llvm-svn: 181528
Diffstat (limited to 'clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp')
| -rw-r--r-- | clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp b/clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp index 050f44ef900..9597c63a6f2 100644 --- a/clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp +++ b/clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp @@ -32,7 +32,7 @@ void sameNames() { void macroConflict() { S MAXs; - for (S::const_iterator it = MAXs.begin(), e = MAXs.end(); it != e; ++it) { + for (S::iterator it = MAXs.begin(), e = MAXs.end(); it != e; ++it) { printf("s has value %d\n", (*it).x); printf("Max of 3 and 5: %d\n", MAX(3,5)); } @@ -40,6 +40,14 @@ void macroConflict() { // CHECK-NEXT: printf("s has value %d\n", (MAXs_it).x); // CHECK-NEXT: printf("Max of 3 and 5: %d\n", MAX(3,5)); + for (S::const_iterator it = MAXs.begin(), e = MAXs.end(); it != e; ++it) { + printf("s has value %d\n", (*it).x); + printf("Max of 3 and 5: %d\n", MAX(3,5)); + } + // CHECK: for (auto const & MAXs_it : MAXs) + // CHECK-NEXT: printf("s has value %d\n", (MAXs_it).x); + // CHECK-NEXT: printf("Max of 3 and 5: %d\n", MAX(3,5)); + T DEFs; for (T::iterator it = DEFs.begin(), e = DEFs.end(); it != e; ++it) { if (*it == DEF) { |

