llvm-capstone/clang/test/PCH/builtin-bit-cast.cpp
hyd-dev 95d7ccb70b [PCH] Support writing BuiltinBitCastExprs to PCHs
eee944e7f adds the new BuiltinBitCastExpr, but does not set the Code member of
ASTStmtWriter. This is not correct and causes an assertion failue in
ASTStmtWriter::emit() when building PCHs that contain __builtin_bit_cast.  This
commit adds serialization::EXPR_BUILTIN_BIT_CAST and handles
ASTStmtWriter::Code properly.

Differential revision: https://reviews.llvm.org/D80360
2020-06-11 13:37:01 -04:00

20 lines
345 B
C++

// RUN: %clang_cc1 -emit-pch -o %t %s
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
template <class T, class U>
constexpr T BuiltinBitCastWrapper(const U &Arg) {
return __builtin_bit_cast(T, Arg);
}
#else
int main() {
return BuiltinBitCastWrapper<int>(0);
}
#endif