Repository navigation
[GNATS 24681] Spurious diagnostic for expression must have a constant value #127
jhsedg
started this conversation in
Issue Triage - General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Customer bug ID
hof/test/function.cpp, gnats/24681.C
Description
Here is the reduced test case:
//type:fp
//options_all:--c++20 --gnu_version 110100 -tused -w
template struct seq;
template struct basic_first_of_adaptor : F1 {};
struct pack_tag;
template <class...> struct pack_base;
template <class, class, class X> constexpr int pack_get(X) { return 0; }
template <unsigned long... Ns, class... Ts>
struct pack_base<seq<Ns...>, Ts...> {
template constexpr auto operator()(F f) {
return f(pack_get<Ts, pack_tag>(this)...);
}
};
struct {
template <class... Ts>
constexpr auto operator()(Ts...) -> decltype(pack_base<seq<0>, Ts &&...>()) {
return pack_base<seq<0>, Ts &&...>();
}
} pack_forward;
template struct partial_adaptor;
struct mono_class;
template struct partial_adaptor_invoke {
constexpr F get_function() {
return static_cast<partial_adaptor<mono_class> &>(*this);
}
template <class... Ts> constexpr auto operator()(Ts...) {
auto __trans_tmp_1 = pack_forward(Ts()...);
pack_base __trans_tmp_4(__trans_tmp_1);
return __trans_tmp_4(get_function());
}
};
struct partial_adaptor_base {
typedef basic_first_of_adaptor<partial_adaptor_invoke<mono_class>> type;
};
template struct partial_adaptor : partial_adaptor_base::type, F {
partial_adaptor_base::type::operator();
template partial_adaptor(S);
};
struct mono_class {
constexpr int operator()(int) { return 1; }
} mono_partial_constexpr;
struct test_63 {
void operator()() const;
};
void test_63::operator()() const {
partial_adaptor<mono_class> __trans_tmp_6 = mono_partial_constexpr;
static_assert(__trans_tmp_6(2));
}
[ellen@lin1 modules]$ (nrt-mods)fgrep Temporary ms_mods.9.3 | wc -l
fe_only -DTEST_NUMBER=1 --c++20 --gnu_version 110100 -tused -w Test_name.c
"Test_name.c", line 47: error: expression must have a constant value
static_assert(__trans_tmp_6(2));
^
"Test_name.c", line 24: note: attempt to access run-time storage
return static_cast<partial_adaptor<mono_class> &>(*this);
^
"Test_name.c", line 29: note: called from:
return __trans_tmp_4(get_function());
^
1 error detected in the compilation of "Test_name.c".
24680.C:fp::FAIL--NO PREVIOUS OUTPUT:
Notes
2024-12-17, ellen:
Boost 1.87.0 no longer has this test (the math portion was a major update)
All reactions