From: Reid Kleckner Date: Mon, 13 Mar 2017 18:42:30 +0000 (+0000) Subject: Widen bitfield for type specifiers for OpenCL types X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e140f99b0ce65f32cb7ca24188181f9a4fa5e4a;p=clang Widen bitfield for type specifiers for OpenCL types Added a static_assert to catch this issue at compile time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297654 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/Specifiers.h b/include/clang/Basic/Specifiers.h index 369a36f3dc..33952f83ff 100644 --- a/include/clang/Basic/Specifiers.h +++ b/include/clang/Basic/Specifiers.h @@ -82,11 +82,12 @@ namespace clang { /// \brief Structure that packs information about the type specifiers that /// were written in a particular type specifier sequence. struct WrittenBuiltinSpecs { - /*DeclSpec::TST*/ unsigned Type : 5; + static_assert(TST_error < 1 << 6, "Type bitfield not wide enough for TST"); + /*DeclSpec::TST*/ unsigned Type : 6; /*DeclSpec::TSS*/ unsigned Sign : 2; /*DeclSpec::TSW*/ unsigned Width : 2; unsigned ModeAttr : 1; - }; + }; /// \brief A C++ access specifier (public, private, protected), plus the /// special value "none" which means different things in different contexts.