public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111277] New: braced-init-list allowed in a template-argument
@ 2023-09-03 17:22 janschultke at googlemail dot com
  2023-09-05 14:27 ` [Bug c++/111277] GCC fails to reject braced-init-list " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: janschultke at googlemail dot com @ 2023-09-03 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111277
           Summary: braced-init-list allowed in a template-argument
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janschultke at googlemail dot com
  Target Milestone: ---

## Code to reproduce (https://godbolt.org/z/ds7zo5Yeo)

#include <cstddef>

template <typename ValueType, std::size_t Size>
struct ArrayPrimitive
{
  constexpr ArrayPrimitive(const ValueType (&array)[Size]) {}
};

template <ArrayPrimitive T>
using ignore = void;

using i = ignore<{{1, 2, 3}}>;


## Explanation

A braced-init-list currently cannot appear in a template-argument.
This is a known defect (https://cplusplus.github.io/CWG/issues/2450.html), but
it is the status quo.

GCC rejects ignore<{1, 2, 3}>, but it does not reject ignore<{{1, 2, 3}}>.

I suspect it fails to recognize the latter as a braced-init-list for whatever
reason.

This bug was discovered here: https://stackoverflow.com/q/77032755/5740428

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

* [Bug c++/111277] GCC fails to reject braced-init-list in a template-argument
  2023-09-03 17:22 [Bug c++/111277] New: braced-init-list allowed in a template-argument janschultke at googlemail dot com
@ 2023-09-05 14:27 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-09-05 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We implement CWG 2450.

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

end of thread, other threads:[~2023-09-05 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-03 17:22 [Bug c++/111277] New: braced-init-list allowed in a template-argument janschultke at googlemail dot com
2023-09-05 14:27 ` [Bug c++/111277] GCC fails to reject braced-init-list " mpolacek 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).