This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


1193. Use of address-constant pointers in constant expressions

Section: 7.7  [expr.const]     Status: C++11     Submitter: Daniel Krügler     Date: 2010-09-02

[Voted into the WP at the March, 2011 meeting.]

It's not clear whether the current rules for constant expressions allow indirect calls of constexpr functions and constexpr member functions; for example,

    constexpr bool is_negative(int x) { return x < 0; }
    constexpr bool check(int x, bool (*p)(int)) { return p(x); }
    static_assert(check(-2, is_negative), "Error");

If this is to be permitted, there does not seem to be a reason to prohibit equality comparison of pointers to functions or pointers to objects of static storage duration -- these can be tracked as is already done for non-type template parameters.

Proposed resolution (November, 2010):

Change 7.7 [expr.const] bullet 2.19 as follows: