comparison clang/test/Modules/const-var-init-update.cpp @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children
comparison
equal deleted inserted replaced
147:c2174574ed3a 150:1d019706d866
1 // RUN: %clang_cc1 -std=c++1z -fmodules %s -verify
2 // expected-no-diagnostics
3
4 #pragma clang module build std
5 module std { module limits {} module other {} }
6 #pragma clang module contents
7 #pragma clang module begin std.limits
8 template<typename T> struct numeric_limits {
9 static constexpr T __max = 5;
10 static constexpr T max() { return __max; }
11 };
12 #pragma clang module end
13 #pragma clang module begin std.other
14 inline void f() { numeric_limits<int> nl; }
15 #pragma clang module end
16 #pragma clang module endbuild
17
18 #pragma clang module build module_b
19 module module_b {}
20 #pragma clang module contents
21 #pragma clang module begin module_b
22 #pragma clang module import std.limits
23 constexpr int a = numeric_limits<int>::max();
24 #pragma clang module end
25 #pragma clang module endbuild
26
27 #pragma clang module import std.limits
28 #pragma clang module import module_b
29 constexpr int b = a;
30 static_assert(b == 5);