31 lines · cpp
1// RUN: %clang_cc1 -std=c++1z -fmodules %s -verify2// expected-no-diagnostics3 4#pragma clang module build std5module std { module limits {} module other {} }6#pragma clang module contents7#pragma clang module begin std.limits8template<typename T> struct numeric_limits {9 static constexpr T __max = 5;10 static constexpr T max() { return __max; }11};12#pragma clang module end13#pragma clang module begin std.other14inline void f() { numeric_limits<int> nl; }15#pragma clang module end16#pragma clang module endbuild17 18#pragma clang module build module_b19module module_b {}20#pragma clang module contents21#pragma clang module begin module_b22#pragma clang module import std.limits23constexpr int a = numeric_limits<int>::max();24#pragma clang module end25#pragma clang module endbuild26 27#pragma clang module import std.limits28#pragma clang module import module_b29constexpr int b = a;30static_assert(b == 5);31