llvm-project/clang/test/AST/ast-dump-implicit-align-val.cpp
earnol 4eedd518be
[clang-tidy] Do not provide diagnostics for cert-dcl58-cpp on implicit declarations (#188152)
Do not provide diagnostics for cert-dcl58-cpp for compiler generated
intrinsic as it will be a false positive.

In provided tests compiler generates align_val_t which ends up inside
std namespace, resulting in std::align_val_t symbol. This symbol is
compiler generated, having no location, causing compiler crash. Also
there is no point to notify user about violations which user has no
control of.

Resolution: Diagnostics suppressed.

Co-authored-by: Vladislav Aranov <vladislav.aranov@ericsson.com>
2026-03-24 12:40:49 -04:00

19 lines
875 B
C++

// This test checks that the implicit std::align_val_t is created with no source
// location and marked implicit when a new-expression triggers its synthesis.
// align_val_t is implicitly created in C++17+ (aligned allocation on by default).
// RUN: %clang_cc1 -std=c++17 -ast-dump %s | FileCheck %s
// RUN: %clang_cc1 -std=c++20 -ast-dump %s | FileCheck %s
// RUN: %clang_cc1 -std=c++23 -ast-dump %s | FileCheck %s
// In older standards, -faligned-allocation must be explicit.
// RUN: %clang_cc1 -std=c++03 -faligned-allocation -ast-dump %s | FileCheck %s
// RUN: %clang_cc1 -std=c++11 -faligned-allocation -ast-dump %s | FileCheck %s
// RUN: %clang_cc1 -std=c++14 -faligned-allocation -ast-dump %s | FileCheck %s
namespace std {}
void *p = new int;
// CHECK: NamespaceDecl {{.*}} std
// CHECK: EnumDecl {{.*}} <<invalid sloc>> <invalid sloc> implicit class align_val_t