[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / clang / test / AST / ms-constexpr.cpp
blob673af1234f4430766b25ad917d45e5cba0d39f84
1 // RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -ast-dump -verify %s | FileCheck %s
2 // RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -ast-dump -verify %s -fexperimental-new-constant-interpreter | FileCheck %s
3 // expected-no-diagnostics
5 // CHECK: used f1 'bool ()'
6 // CHECK: MSConstexprAttr 0x{{[0-9a-f]+}} <col:3, col:9>
7 [[msvc::constexpr]] bool f1() { return true; }
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>
14 constexpr bool f2() { [[msvc::constexpr]] return f1(); }
15 static_assert(f2());
17 struct S1 {
18 // CHECK: used vm 'bool ()' virtual
19 // CHECK: MSConstexprAttr 0x{{[0-9a-f]+}} <col:7, col:13>
20 [[msvc::constexpr]] virtual bool vm() { return true; }
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(); }
29 static_assert(S1{}.cm());