clang/test/Modules/var-init-side-effects-templated.cpp
raw| 1 | // Tests referencing variable with initializer containing side effect across module boundary |
| 2 | |
| 3 | // RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -o %t |
| 4 | |
| 5 | export module Foo; |
| 6 | |
| 7 | export template <class Float> |
| 8 | struct Wrapper { |
| 9 | double value; |
| 10 | }; |
| 11 | |
| 12 | export constexpr Wrapper<double> Compute() { |
| 13 | return Wrapper<double>{1.0}; |
| 14 | } |
| 15 | |
| 16 | export template <typename Float> |
| 17 | Wrapper<Float> ComputeInFloat() { |
| 18 | const Wrapper<Float> a = Compute(); |
| 19 | return a; |
| 20 | } |