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

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 9 17:28:16 PDT 2019


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

            Bug ID: 42214
           Summary: non-const lvalue reference to type is actually
                    allowed?
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

My clang is 9.0.0, and the code is:

template<class ...V>
struct VariableList {
 void ConnectAllToAll(VariableList<>& params = VariableList<>()) {
 }
};

clang rejects it:

<source>:3:39: error: non-const lvalue reference to type 'VariableList<>'
cannot bind to a temporary of type 'VariableList<>'

 void ConnectAllToAll(VariableList<>& params = VariableList<>()) {

                                      ^        ~~~~~~~~~~~~~~~~

<source>:3:39: note: passing argument to parameter 'params' here

1 error generated.

Compiler returned: 1

However, icc, gcc, and msvc all accept the code. non-const lvalue reference to
type is actually allowed?

-- 
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/20b52470/attachment.html>


More information about the llvm-bugs mailing list