llvm-project/clang/test/CIR/CodeGen/nonzeroinit-struct.cpp
Andy Kaylor 8d9f5160b4
[CIR] Unblock simple C++ structure support (#138368)
This change adds additional checks to a few places where a simple struct
in C++ code was triggering `errorNYI` in places where no additional
handling was needed, and adds a very small amount of trivial
initialization. The code now checks for the conditions that do require
extra handling before issuing the diagnostic.

New tests are added for declaring and using a simple struct in C++ code.
2025-05-07 09:21:01 -07:00

20 lines
533 B
C++

// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o - 2>&1 | FileCheck %s
struct Other {
int x;
};
struct Trivial {
int x;
double y;
decltype(&Other::x) ptr;
};
// This case has a trivial default constructor, but can't be zero-initialized.
Trivial t;
// Since the case above isn't handled yet, we want a test that verifies that
// we're failing for the right reason.
// CHECK: error: ClangIR code gen Not Yet Implemented: tryEmitPrivateForVarInit: non-zero-initializable cxx record