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

            Bug ID: 90047
           Summary: internal compiler error: in finish_expr_stmt, at
                    cp/semantics.c:680
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: harriethijssen65 at gmail dot com
  Target Milestone: ---

Created attachment 46142
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46142&action=edit
temporary compile file from COLIRU

Hit the above error with included code.

Interesting fact is that when commenting out struct Message_t (not required in
test code) does not generate this error. It is seemingly unrelated, but causes
the compiler to complain when this code is present.

Please do not comment on the semantics: the code is "dumbed down" to minimum
lines for clarity.

Thanks.

Code:

// This file can be also found using the Coliru command line: cat
/Archive2/56/3d8a97d31a1950/main.cpp

#include <iostream>
#include <cstring>

template<typename T, char const* TAG>
struct STR  {
    static constexpr const char* tag = TAG;
    STR()  {memset(&v, 0, sizeof(v));}
    STR(T value) {operatorAssign(value);}
    template <class U, std::enable_if_t<!std::is_array<T>::value>* = nullptr>
    T& operatorAssign(const T& rhs) {return v; }
    T v;
};

typedef
class Message {
  public:
    enum severity_t {} ;
    friend std::ostream& operator<< (std::ostream& os, const Message& message)
{os << message._severity << ": ";return os;}
    severity_t _severity;
    std::string _message;
} Message_t;

extern char const ctag1[] = "tag1"; 

int main() {
    STR<char[10], ctag1> c1;
    c1 = (char*)"abcdefghij";
}

Reply via email to