Skip to content

[expr.const]p14 example incorrect after P1937R2 #3792

@zygoloid

Description

@zygoloid

After the application of P1937R2, this example from the end of [expr.const]p14 is no longer correct or useful:

[ Example:

struct N {
  constexpr N() {}
  N(N const&) = delete;
};
template<typename T> constexpr void bad_assert_copyable() { T t; T t2 = t; }
using ineffective = decltype(bad_assert_copyable<N>());
                        // bad_­assert_­copyable<N> is not needed for constant evaluation
                        // (and thus not instantiated)
template<typename T> consteval void assert_copyable() { T t; T t2 = t; }
using check = decltype(assert_copyable<N>());
                        // error: assert_­copyable<N> is instantiated (because it is needed for constant
                        // evaluation), but the attempt to copy t is ill-formed

end example ]

The distinction it's trying to draw attention to was removed by P1937R2, so let's just remove the example rather than trying to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions