On Sun, 6 Jun 2021 at 19:54, Johannes Schaub via Std-Discussion <std-discussion@lists.isocpp.org> wrote:
This is an item in issue http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#325 . A couple of community members created an openoffice document during C++11 last-minute-fixes and this was on that list.

Hm, here's a fun one:

struct C {
    C(bool);
    constexpr C(int) {}
    constexpr C& operator=(int)&& { return *this; }
    constexpr operator int() const { return 22; }
};
static constexpr int x = 33;
static constexpr int y = 44;
struct A {
    template<intintstatic bool f(int);
    //static constexpr int f = 77;
    int g(bool = f<55, C(x) = 66>(y));
};
int i = A().g(); 

MSVC and icc accept (with A::g a function of 1 argument); gcc and clang reject. If f is changed to the non-template static data member (s.t. A::g is now a function of 2 arguments), everyone accepts.

If f as a static member function template is moved to after g, all reject; if it is a non-template static data member all except icc accept.

Eric Suen via Std-Discussion <std-discussion@lists.isocpp.org> schrieb am So., 6. Juni 2021, 20:16:
>
> NSDMIs are evaluated in a complete-class context. This is one reason
> they can't be `auto`.
>
How do you get complete-class context when you unable to parse

   int a = V<1>();

correctly?

Look ahead for ';' if you encounter '=' in declarator?
--
Std-Discussion mailing list
Std-Discussion@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
--
Std-Discussion mailing list
Std-Discussion@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion