diff options
author | Brian Gesiak <modocache@gmail.com> | 2019-02-01 03:30:29 +0000 |
---|---|---|
committer | Brian Gesiak <modocache@gmail.com> | 2019-02-01 03:30:29 +0000 |
commit | 3aba9fd64f98c0527859904775244b2298a8e276 (patch) | |
tree | 86a12577fe244aafcb0e785b961433a28820ad7f /llvm/lib/Support/CommandLine.cpp | |
parent | 473e3420ce37fae60f7c6d1e6b08adc1fd0de71e (diff) | |
download | llvm-3aba9fd64f98c0527859904775244b2298a8e276.zip llvm-3aba9fd64f98c0527859904775244b2298a8e276.tar.gz llvm-3aba9fd64f98c0527859904775244b2298a8e276.tar.bz2 |
[SemaCXX] Param diagnostic matches overload logic
Summary:
Given the following test program:
```
class C {
public:
int A(int a, int& b);
};
int C::A(const int a, int b) {
return a * b;
}
```
Clang would produce an error message that correctly diagnosed the
redeclaration of `C::A` to not match the original declaration (the
parameters to the two declarations do not match -- the original takes an
`int &` as its 2nd parameter, but the redeclaration takes an `int`). However,
it also produced a note diagnostic that inaccurately pointed to the
first parameter, claiming that `const int` in the redeclaration did not
match the unqualified `int` in the original. The diagnostic is
misleading because it has nothing to do with why the program does not
compile.
The logic for checking for a function overload, in
`Sema::FunctionParamTypesAreEqual`, discards cv-qualifiers before
checking whether the types are equal. Do the same when producing the
overload diagnostic.
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: cpplearner, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57032
llvm-svn: 352831
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
0 files changed, 0 insertions, 0 deletions