brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 673af12 Raw
30 lines · cpp
1// RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -ast-dump -verify %s | FileCheck %s2// RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -ast-dump -verify %s -fexperimental-new-constant-interpreter | FileCheck %s3// expected-no-diagnostics4 5// CHECK: used f1 'bool ()'6// CHECK: MSConstexprAttr 0x{{[0-9a-f]+}} <col:3, col:9>7[[msvc::constexpr]] bool f1() { return true; }8 9// CHECK: used constexpr f2 'bool ()'10// CHECK-NEXT: CompoundStmt 0x{{[0-9a-f]+}} <col:21, col:56>11// CHECK-NEXT: AttributedStmt 0x{{[0-9a-f]+}} <col:23, col:53>12// CHECK-NEXT: MSConstexprAttr 0x{{[0-9a-f]+}} <col:25, col:31>13// CHECK-NEXT: ReturnStmt 0x{{[0-9a-f]+}} <col:43, col:53>14constexpr bool f2() { [[msvc::constexpr]] return f1(); }15static_assert(f2());16 17struct S1 {18    // CHECK: used vm 'bool ()' virtual19    // CHECK: MSConstexprAttr 0x{{[0-9a-f]+}} <col:7, col:13>20    [[msvc::constexpr]] virtual bool vm() { return true; }21 22    // CHECK: used constexpr cm 'bool ()'23    // CHECK-NEXT: CompoundStmt 0x{{[0-9a-f]+}} <col:25, col:60>24    // CHECK-NEXT: AttributedStmt 0x{{[0-9a-f]+}} <col:27, col:57>25    // CHECK-NEXT: MSConstexprAttr 0x{{[0-9a-f]+}} <col:29, col:35>26    // CHECK-NEXT: ReturnStmt 0x{{[0-9a-f]+}} <col:47, col:57>27    constexpr bool cm() { [[msvc::constexpr]] return vm(); }28};29static_assert(S1{}.cm());30