public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95369] New: braced-init-list with designated initializers as template-argument rejected
@ 2020-05-27 17:38 mpolacek at gcc dot gnu.org
  2020-05-27 17:41 ` [Bug c++/95369] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-27 17:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95369

            Bug ID: 95369
           Summary: braced-init-list with designated initializers as
                    template-argument rejected
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

struct S {
  unsigned a;
  unsigned b;
#ifdef CTOR
  constexpr S(unsigned _a, unsigned _b) noexcept: a{_a}, b{_b} { }
#endif
};

template <S p>
void fnc()
{
}

template<S s> struct X { };

void f()
{
  fnc<{.a = 10, .b = 20}>();
  X<{.a = 1, .b = 2}> x;
}

If CTOR is not defined, we reject, but if it is defined, we accept.  We should
probably reverse this behavior.  We should accept the aggregate initialization,
but with CTOR, S is no longer an aggregate (it has a user-declared or inherited
constructor).

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-07-27 22:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 17:38 [Bug c++/95369] New: braced-init-list with designated initializers as template-argument rejected mpolacek at gcc dot gnu.org
2020-05-27 17:41 ` [Bug c++/95369] " mpolacek at gcc dot gnu.org
2020-05-27 18:40 ` mpolacek at gcc dot gnu.org
2020-05-27 19:17 ` mpolacek at gcc dot gnu.org
2020-05-28 20:45 ` mpolacek at gcc dot gnu.org
2020-06-05 19:51 ` cvs-commit at gcc dot gnu.org
2020-06-16 17:21 ` cvs-commit at gcc dot gnu.org
2020-06-16 17:23 ` mpolacek at gcc dot gnu.org
2021-07-27 22:13 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).