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

            Bug ID: 68508
           Summary: Internal compiler error with parentheses around return
                    value in C++14 with ASan enabled
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kainjow at kainjow dot com
  Target Milestone: ---

Using latest i386 ArchLinux with GCC 5.2, I am able to generate an internal
compiler error with this code:

class A {
public:
  A() {}

  static const A& a() {
      static A _a = A();
      return (_a);
  }

  virtual A& operator= (const A&) {
      return *this;
  }
};

int main() {
  return 0;
}

Compile it with:

g++ -std=c++14 -fsanitize=undefined test.cpp

This will generate:

test.cpp: In static member function ‘static const A& A::a()’:
test.cpp:7:19: internal compiler error: in check_return_expr, at
cp/typeck.c:8682
       return (_a);

Reply via email to