public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94422] New: static_cast from std::array to enum class
@ 2020-03-31  9:41 vincent.hamp at higaski dot at
  2020-03-31 10:17 ` [Bug c++/94422] [9 Regression] static_cast from std::array operator[] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vincent.hamp at higaski dot at @ 2020-03-31  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94422
           Summary: static_cast from std::array to enum class
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent.hamp at higaski dot at
  Target Milestone: ---

static_cast from std::array operator[] to an enum class inside a template class
produces an unexpected expression error. It seems that error is only present in
9.3, 9.2 and trunk work.

#include <array>
#include <cstdint>

enum class EnumC : int8_t { Forward = 1, Backward = -1 };

std::array<uint8_t, sizeof(EnumC)> buf;

template <typename T>
struct S {
  void foo() { auto const cast_to_enum{static_cast<EnumC>(buf[0])}; }
};

S<int> s;

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

end of thread, other threads:[~2022-05-27  8:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31  9:41 [Bug c++/94422] New: static_cast from std::array to enum class vincent.hamp at higaski dot at
2020-03-31 10:17 ` [Bug c++/94422] [9 Regression] static_cast from std::array operator[] " redi at gcc dot gnu.org
2020-03-31 10:24 ` [Bug c++/94422] [9/10 " redi at gcc dot gnu.org
2020-03-31 11:59 ` [Bug c++/94422] [9 " rguenth at gcc dot gnu.org
2020-03-31 16:23 ` jakub at gcc dot gnu.org
2021-06-01  8:17 ` rguenth at gcc dot gnu.org
2022-05-27  8:50 ` rguenth 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).