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: unassignedclangb...@nondot.org
          Reporter: zhong...@pku.org.cn
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to