Title
Member type depending on definition of member function
Status
drafting
Section
11.4 [class.mem]
Submitter
Hubert Tong

Created on 2014-03-07.00:00:00 last changed 11 months ago

Messages

Date: 2023-11-15.00:00:00

Additional notes (November, 2023):

The following example is also rejected by implementations, but it is allowed by the rules:

    struct A {
      static bool f2() { return f(); }

      static consteval bool f() { return true; }
    };
Date: 2023-01-15.00:00:00

Additional notes (January, 2023):

The following example might be related:

  #include <type_traits>

  struct Bar {
    struct Baz {
      int a = 0;
    };
    static_assert(std::is_default_constructible_v<Baz>);
  };
Date: 2014-03-07.00:00:00

Consider an example like:

  struct A {
    struct B {
      auto foo() { return 0; }
    };
    decltype(B().foo()) x;
  };

There does not appear to be a prohibition of cases like this, where the type of a member depends on the definition of a member function.

(See also issues 1360, 1397, and 2335.)

History
Date User Action Args
2024-01-01 08:20:14adminsetmessages: + msg7563
2023-01-29 22:11:52adminsetmessages: + msg7158
2014-07-07 00:00:00adminsetstatus: open -> drafting
2014-03-07 00:00:00admincreate