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

            Bug ID: 93513
           Summary: internal compiler error internal compiler error:
                    unexpected expression ‘(char)(e)’ of kind cast_expr
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andij.cr at gmail dot com
  Target Milestone: ---

compiling this c++ code

enum class error {};
template <typename F>
void afunction(F) {
  error{char(0)};
}


with g++ 9.2
with std=c++17 or std=c++20

will give 
internal compiler error: unexpected expression ‘(char)(0)’ of kind cast_expr
    4 |   error{char(0)};
      |                ^

in contrast, with std=c++14:
error: cannot convert ‘char’ to ‘error’ in initialization
    4 |   error{char(0)};
      |         ^~~~~~~
      |         |
      |         char


checking with compiler explorer, it seems that gcc 8.3 does not generate this
error: https://gcc.godbolt.org/z/yZ9ckH

Reply via email to