[llvm-bugs] [Bug 49586] New: Regression where LValue Ref gets incorrectly reported as an RValue Ref

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 14 08:07:40 PDT 2021


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

            Bug ID: 49586
           Summary: Regression where LValue Ref gets incorrectly reported
                    as an RValue Ref
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dpsicilia 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

Minimal reproducer showing regression from clang 11.0.1 to trunk:

https://godbolt.org/z/a8z8b8

Flags: -std=c++20 -stdlib=libc++
===========================================
#include <type_traits>

struct O {
  template<typename U>
  O( U&& u ) {
    static_assert( std::is_lvalue_reference<U>::value );
  }
};

struct A {};
A a;

O make_o() {
  A& a_ref = a;
  return a_ref;
}
===========================================

In clang 11.0.1 the static_assert passes, but on trunk it fails.  I tried also
changing the static_assert to this:

static_assert( std::is_lvalue_reference<decltype(std::forward<U>(u))>::value );

but same behavior.  Also, this seems to only happen in C++20 mode.

-- 
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/20210314/06226186/attachment-0001.html>


More information about the llvm-bugs mailing list