From 0a223d981e6d57a051c77a65cdee9f7024e1bc35 Mon Sep 17 00:00:00 2001 From: Erik Pilkington Date: Mon, 12 Aug 2019 18:31:27 +0000 Subject: [Sema] Require a complete type for __builtin_bit_cast operands Fixes llvm.org/PR42936 llvm-svn: 368600 --- clang/test/SemaCXX/builtin-bit-cast.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/test/SemaCXX/builtin-bit-cast.cpp') diff --git a/clang/test/SemaCXX/builtin-bit-cast.cpp b/clang/test/SemaCXX/builtin-bit-cast.cpp index 3dddadc5617..87919d9d9d2 100644 --- a/clang/test/SemaCXX/builtin-bit-cast.cpp +++ b/clang/test/SemaCXX/builtin-bit-cast.cpp @@ -37,3 +37,12 @@ constexpr unsigned long ul = __builtin_bit_cast(unsigned long, not_trivially_cop // expected-error@+1 {{__builtin_bit_cast destination type must be trivially copyable}} constexpr long us = __builtin_bit_cast(unsigned long &, 0L); + +namespace PR42936 { +template struct S { int m; }; + +extern S extern_decl; + +int x = __builtin_bit_cast(int, extern_decl); +S y = __builtin_bit_cast(S, 0); +} -- cgit v1.2.3