aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Modules/var-init-side-effects-templated.cpp
blob: 542ca270429b6f797793d998612e4ec0ae8e06f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Tests referencing variable with initializer containing side effect across module boundary

// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -o %t

export module Foo;

export template <class Float>
struct Wrapper {
  double value;
};

export constexpr Wrapper<double> Compute() {
  return Wrapper<double>{1.0};
}

export template <typename Float>
Wrapper<Float> ComputeInFloat() {
  const Wrapper<Float> a = Compute();
  return a;
}