Mital Ashok
Mital Ashok
C99 §5.1.1.2p2, C23 §5.1.1.2p2 > A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character before any...
Consider the following: ```c++ template extern T const p; template extern constexpr T p{}; static_assert(!p, ""); static_assert(!p, ""); ``` Currently, the second assert fails complaining that "initializer of 'p' is...
Consider the following: ```c++ template extern T const p; template extern constexpr T p{}; static_assert(!p, ""); static_assert(!p, ""); ``` Currently, the second assert fails complaining that "initializer of 'p' is...
Compiler explorer link: https://godbolt.org/z/74bErMhEs Compiling this crashes the compiler: ```c++ // clang++ -std=c++20 -fsyntax-only struct true_type { constexpr operator bool() const { return true; } }; constexpr auto f() {...
An unnecessary zeroextend / signextend is emitted to zero bits that are already assumed to be zero. For example: ```c++ void take_u16(std::uint16_t); void u32_to_u16(std::uint32_t x) { __builtin_assume(std::in_range(x)); take_u16(x); } ```...
Related: #77754 ```c++ struct unrelated_type {}; int main() { void(* p)() noexcept = []() noexcept(({ return unrelated_type{}; true; })) {}; bool(* q)() = []() -> decltype(({ return unrelated_type{}; true; }))...
Example: ```c++ struct X { X(int x) { __builtin_printf("X(%d)\n", x); } static void operator()() { __builtin_printf("operator()\n"); } static void operator[]() { __builtin_printf("operator[]\n"); } static void f(int) { __builtin_printf("f\n"); } };...
https://godbolt.org/z/ofozszdr7 Compiled with `clang++ --target=i686-win32` ```c++ struct A { ~A(); }; void __thiscall f(A) {} ``` ``` clang-18: /llvm-project/llvm/include/llvm/IR/DataLayout.h:652: llvm::TypeSize llvm::StructLayout::getElementOffset(unsigned int) const: Assertion `Idx < NumElements && "Invalid element...
https://itanium-cxx-abi.github.io/cxx-abi/abi.html#POD > However, a type is not considered to be a POD for the purpose of layout if it is: > - [...] > - a POD-struct with one or...
Small example : ```c++ void g(); template struct Capture; template struct Capture { friend void g() { &T::a; } }; struct X; void f() { union { int a =...