xref: /llvm-project/clang/test/PCH/default-argument-with-immediate-calls.cpp (revision ca619613801233ef2def8c3cc7d311d5ed0033cb)
1 // RUN: %clang_cc1 -std=c++20 -emit-pch %s -o %t
2 // RUN: %clang_cc1 -std=c++20 -include-pch %t -verify %s
3 // expected-no-diagnostics
4 
5 #ifndef HEADER_INCLUDED
6 #define HEADER_INCLUDED
7 
8 consteval int immediate();
regular_function()9 int regular_function() {
10     return 0;
11 }
12 
13 struct S {
14   int a = immediate() + regular_function();
15 };
16 
f(int arg=immediate ())17 int f(int arg = immediate()) {
18     return arg;
19 }
20 
21 #else
22 
immediate()23 consteval int immediate() {
24     return 0;
25 }
26 
test()27 void test() {
28     f(0);
29     f();
30     S s{0};
31     S t{0};
32 }
33 
34 #endif
35