From 4f64e1819b914f8ab9a5d6262b48506510d66d97 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Fri, 11 Nov 2011 02:00:42 +0000 Subject: [PATCH] Make sure that restrict-qualifying an array actually adds a restrict qualifier. PR11354. (operator bool() is evil!) llvm-svn: 144355 --- clang/lib/Sema/SemaType.cpp | 3 +-- clang/test/Sema/function.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 4dc6c949d59c..fa002bba1981 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -2032,8 +2032,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, 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/clang/test/Sema/function.c b/clang/test/Sema/function.c index b51c137ce7dc..1eb5ac4623df 100644 --- a/clang/test/Sema/function.c +++ b/clang/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);