[llvm-bugs] [Bug 46135] New: Passing an unused reference to an object with automatic storage duration into a consteval function should be an error

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 29 12:37:38 PDT 2020


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

            Bug ID: 46135
           Summary: Passing an unused reference to an object with
                    automatic storage duration into a consteval function
                    should be an error
           Product: clang
           Version: 10.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nliber+llvm 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

The following code compiles fine but shouldn't (and doesn't under gcc 10.1):

template<typename T>
consteval void A(T&& /* deliberately unused */) { /* ... */ }

int main()
{
    int i;
    int& ri = i;
    A(ri);
}

Richard Smith:  It looks like clang allows use of references whose initializers
are merely core constant expressions, even if they're not actually constant
expressions.

-- 
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/20200529/650707bb/attachment.html>


More information about the llvm-bugs mailing list