[llvm-bugs] [Bug 34912] New: Brace-init of const type to non-const reference produces error message with missing/incorrect types
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 10 20:25:11 PDT 2017
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: unassignedclangbugs at nondot.org
Reporter: anthonym.leedom at gmail.com
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171011/d447ba86/attachment.html>
More information about the llvm-bugs
mailing list