Make sure that restrict-qualifying an array actually adds a restrict qualifier. PR11354. (operator bool() is evil!)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144355 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 4dc6c94..fa002bb 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -2032,8 +2032,7 @@
ASM = ArrayType::Normal;
D.setInvalidType(true);
}
- T = S.BuildArrayType(T, ASM, ArraySize,
- Qualifiers::fromCVRMask(ATI.TypeQuals),
+ T = S.BuildArrayType(T, ASM, ArraySize, ATI.TypeQuals,
SourceRange(DeclType.Loc, DeclType.EndLoc), Name);
break;
}
diff --git a/test/Sema/function.c b/test/Sema/function.c
index b51c137..1eb5ac4 100644
--- a/test/Sema/function.c
+++ b/test/Sema/function.c
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
-// PR1892
-void f(double a[restrict][5]); // should promote to restrict ptr.
-void f(double (* restrict a)[5]);
+
+// PR1892, PR11354
+void f(double a[restrict][5]) { __typeof(a) x = 10; } // expected-warning {{(aka 'double (*restrict)[5]')}}
int foo (__const char *__path);
int foo(__const char *__restrict __file);