public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67881] New: type deduced incorrectly in constructor template when binding to const int
@ 2015-10-07  8:15 akrzemi1 at gmail dot com
  2015-10-07  8:25 ` [Bug c++/67881] " trippels at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: akrzemi1 at gmail dot com @ 2015-10-07  8:15 UTC (permalink / raw)
  To: gcc-bugs

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).


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/67881] type deduced incorrectly in constructor template when binding to const int
  2015-10-07  8:15 [Bug c++/67881] New: type deduced incorrectly in constructor template when binding to const int akrzemi1 at gmail dot com
@ 2015-10-07  8:25 ` trippels at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-10-07  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |trippels at gcc dot gnu.org
         Resolution|---                         |WORKSFORME

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
This works fine with current gcc-5 branch and gcc-6.
Closing.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-07  8:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-07  8:15 [Bug c++/67881] New: type deduced incorrectly in constructor template when binding to const int akrzemi1 at gmail dot com
2015-10-07  8:25 ` [Bug c++/67881] " trippels at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).