Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brace-init of const type to non-const reference produces error message with missing/incorrect types #34260

Closed
a-n-t-h-o-n-y mannequin opened this issue Oct 11, 2017 · 1 comment
Labels
bugzilla Issues migrated from bugzilla c++14

Comments

@a-n-t-h-o-n-y
Copy link
Mannequin

a-n-t-h-o-n-y mannequin commented Oct 11, 2017

Bugzilla Link 34912
Resolution FIXED
Resolved on Jul 13, 2018 02:56
Version 4.0
OS Linux

Extended Description

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 <> 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.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 13, 2018

This has been fixed in r336922, thanks! :)

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++14
Projects
None yet
Development

No branches or pull requests

1 participant