1 
2 // NOTE: source_location.cpp must include this file after defining
3 // std::source_location.
4 namespace source_location_file {
5 
6 constexpr const char *FILE = __FILE__;
7 
8 constexpr SL global_info = SL::current();
9 
10 constexpr SL test_function(SL v = SL::current()) {
11   return v;
12 }
13 
test_function_indirect()14 constexpr SL test_function_indirect() {
15   return test_function();
16 }
17 
18 template <class T, class U = SL>
19 constexpr U test_function_template(T, U u = U::current()) {
20   return u;
21 }
22 
23 template <class T, class U = SL>
test_function_template_indirect(T t)24 constexpr U test_function_template_indirect(T t) {
25   return test_function_template(t);
26 }
27 
28 struct TestClass {
29   SL info = SL::current();
30   SL ctor_info;
31   TestClass() = default;
ctor_infoTestClass32   constexpr TestClass(int, SL cinfo = SL::current()) : ctor_info(cinfo) {}
33   template <class T, class U = SL>
ctor_infoTestClass34   constexpr TestClass(int, T, U u = U::current()) : ctor_info(u) {}
35 };
36 
37 template <class T = SL>
38 struct AggrClass {
39   int x;
40   T info;
41   T init_info = T::current();
42 };
43 
44 } // namespace source_location_file
45