[llvm-bugs] [Bug 50779] New: regression Clang >= 11 rejects consteval subscript operator use

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 20 09:39:48 PDT 2021


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: unassignedclangbugs at nondot.org
          Reporter: wjwray at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210620/ce9f0907/attachment.html>


More information about the llvm-bugs mailing list