https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67881

            Bug ID: 67881
           Summary: type deduced incorrectly in constructor template when
                    binding to const int
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: akrzemi1 at gmail dot com
  Target Milestone: ---

My class has a perfect-forwarding non-explicit constructor. I expect that when
it binds to a constant lvalue of type int, it recognizes the type as lvalue
reference. My expectation is illustrated with the static_assert in the code:

```
#include <type_traits>

struct any_
{
    template <class R> any_(R&&) {
        static_assert(std::is_lvalue_reference<R>::value, "expected lvalue
ref");
    }
};

int main()
{
    const int i = 7;
    any_ oi = i;
}
```

This assertion fails in gcc 5.1 and 5.2 (but passes in 4.8 and 4.9).

Reply via email to