Skip to content

Spurious initializer shown for default-constructed variables #1238

Description

@gennaroprota

When documenting mp-units, variables that are default-constructed instances of a type having their same name are rendered with an initializer (which doesn't appear in the source). For example, the synopses show:

inline constexpr one one = one;
inline constexpr percent percent = percent;
inline constexpr pi pi = pi;
inline constexpr pi_c pi_c = pi_c;

The corresponding declarations are:

inline constexpr struct one final : detail::derived_unit_impl<> {} one;
inline constexpr struct percent final : named_unit<"%", mag_ratio<1, 100> * one> {} percent;
inline constexpr struct pi final : named_constant<symbol_text{u8"π", "pi"}, mag<pi_c> * one> {} pi;
inline constexpr struct pi_c final : mag_constant<symbol_text{u8"π", "pi"}, std::numbers::pi_v<long double>> {} pi_c;

So one should render as inline constexpr one one;, with no = one, and likewise for the others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions