From: Eli Friedman Date: Fri, 11 Nov 2011 02:00:42 +0000 (+0000) Subject: Make sure that restrict-qualifying an array actually adds a restrict qualifier. PR113... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ac2c66a1442985091c5ec2b33ce6d3df3bcb529;p=clang 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 4dc6c949d5..fa002bba19 100644 --- a/lib/Sema/SemaType.cpp +++ b/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/test/Sema/function.c b/test/Sema/function.c index b51c137ce7..1eb5ac4623 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);