Title
`meta::exception::what()` should be `consteval`
Status
new
Section
[meta.reflection.exception]
Submitter
Jonathan Wakely

Created on 2026-01-28.00:00:00 last changed 1 week ago

Messages

Date: 2026-02-04.12:39:09

Proposed resolution:

This wording is relative to N5032.

  1. Modify [meta.reflection.exception] as indicated:

    namespace std::meta {
      class exception : public std::exception {
      private:
        optional<string> what_;  // exposition only
        u8string u8what_;        // exposition only
        info from_;              // exposition only
        source_location where_;  // exposition only
      public:
        consteval exception(u8string_view what, info from,
                            source_location where = source_location::current()) noexcept;
    
        consteval exception(string_view what, info from,
                            source_location where = source_location::current()) noexcept;
    
        exception(const exception&) = default;
        exception(exception&&) = default;
    
        exception& operator=(const exception&) = default;
        exception& operator=(exception&&) = default;
    
        constexpr consteval const char* what() const noexcept override;
        consteval u8string_view u8what() const noexcept;
        consteval info from() const noexcept;
        consteval source_location where() const noexcept;
      };
    }
    

    constexpr consteval const char* what() const noexcept override;
    

    -5- Constant when: what_.has_value() is `true`.

Date: 2026-01-30.17:52:35

As mentioned in LWG 4494, `meta::exception::what()` can be (and should be) marked `consteval` now that CWG 3117 has been approved.

History
Date User Action Args
2026-01-30 17:52:35adminsetmessages: + msg15906
2026-01-30 17:52:35adminsetmessages: + msg15905
2026-01-30 17:52:35adminrestored
2026-01-29 09:18:46adminretired
2026-01-29 09:18:46adminsetmessages: - msg15898, msg15899
2026-01-28 17:42:42adminsetmessages: + msg15899
2026-01-28 00:00:00admincreate