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

            Bug ID: 34912
           Summary: Brace-init of const type to non-const reference
                    produces error message with missing/incorrect types
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++14
          Assignee: unassignedclangb...@nondot.org
          Reporter: anthonym.lee...@gmail.com
                CC: llvm-bugs@lists.llvm.org

int main() {
    const int i{0};
    int& ref{i};
    return 0;
}


The above code produces the error message:

error: binding value of type 'void' to reference to type 'int' drops <<ERROR>>
qualifiers
    int& ref{f.value};
         ^  ~~~~~~~~~

While the following produces the correct error message:

int main() {
    const int i{0};
    int& ref = i;
    return 0;
}

error: binding value of type 'const int' to reference to type 'int' drops
'const' qualifier
    int& ref = i;

Brace-initialization seems to cause an error in the error reporting, unable to
access the correct types for the message to display. I'm not familiar with
clang internals so I'm not much help here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to