[llvm-bugs] [Bug 42214] non-const lvalue reference to type is actually allowed?

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 9 21:28:03 PDT 2019


Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
> However, icc, gcc, and msvc all accept the code. non-const lvalue reference to
> type is actually allowed?

No, a non-const reference cannot be bound to a temporary -- clang is correct to
diagnose this. But the other implementations are correct too: because this
error occurs in a template, no diagnostic is required until the template is
actually instantiated.

If you add an instantiation:

void f() {
    VariableList<int, float>().ConnectAllToAll();

then GCC and ICC also reject, and MSVC also rejects under /permissive-
(standard-conforming 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/20190610/1547a257/attachment.html>

More information about the llvm-bugs mailing list