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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to