From 8c6c606cdc72c3ddd55f382d91ef1afc3cb9f2a8 Mon Sep 17 00:00:00 2001 From: Yuanfang Chen Date: Tue, 16 Jun 2020 13:00:14 -0700 Subject: [PATCH] [Clang] Add a "#pragma unroll" test case for correct error reporting For PR46336. --- clang/test/Parser/pragma-unroll.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clang/test/Parser/pragma-unroll.cpp b/clang/test/Parser/pragma-unroll.cpp index fb71381..c89cf49 100644 --- a/clang/test/Parser/pragma-unroll.cpp +++ b/clang/test/Parser/pragma-unroll.cpp @@ -55,6 +55,15 @@ void test(int *List, int Length) { #pragma nounroll /* expected-error {{expected a for, while, or do-while loop to follow '#pragma nounroll'}} */ int l = Length; + switch (i) { + case 1: +#pragma unroll +/* expected-error {{expected a for, while, or do-while loop to follow '#pragma unroll'}} */ [[fallthrough]]; + case 2: + for (int i = 0; i < 10; ++i); + break; + } + #pragma unroll 4 /* expected-error {{incompatible directives 'unroll(disable)' and '#pragma unroll(4)'}} */ #pragma clang loop unroll(disable) while (i-10 < Length) { -- 2.7.4