https://bugs.llvm.org/show_bug.cgi?id=50779

            Bug ID: 50779
           Summary: regression Clang >= 11 rejects consteval subscript
                    operator use
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

This is a regression between versions 10.0.1 and 11.0.0
https://godbolt.org/z/dcnbbcKqs

    struct test
    {
        consteval int operator[](int i) const { return {}; }
    };

    constexpr test a{};

    constexpr int s = a.operator[](1); // accept direct call
    constexpr int t = a[1];            // REJECT 

  error: cannot take address of consteval function 'operator[]'  
  outside of an immediate invocation:
    constexpr int t = a[1];
                       ^

Works on GCC >=10.2 but ICE'd 10.1 (which introduced consteval)
 internal compiler error: in extract_call_expr, at cp/call.c:6614
   13 | constexpr int t = a[1];
      |                      ^

Works on MSVC >= v19.28 (which introduced consteval)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to