35 lines · cpp
1// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fno-modules-error-recovery -fno-spell-checking -verify -std=c++17 %s2 3#pragma clang module build a4module a {}5#pragma clang module contents6#pragma clang module begin a7constexpr bool return_true() { return true; }8struct X {9 static void f() noexcept(return_true());10};11#pragma clang module end12#pragma clang module endbuild13 14#pragma clang module build b15module b {}16#pragma clang module contents17#pragma clang module begin b18#pragma clang module import a19using T = decltype(return_true() && noexcept(X::f()));20#pragma clang module end21#pragma clang module endbuild22 23#pragma clang module import a24#pragma clang module import b25 26// Trigger import of return_true and then X::f in the same pass. This causes27// the type of X::f to be loaded while we have a pending body for return_true,28// which means evaluation of its exception specification at that point would29// fail.30T t;31 32static_assert(noexcept(X().f()));33 34// expected-no-diagnostics35