diff options
author | Boaz Brickner <brickner@google.com> | 2024-10-17 16:50:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-17 16:50:47 +0200 |
commit | 8f25c0bc7d59a65f27faa88d7debc47275a3a3da (patch) | |
tree | 738d0556e70b78968760156aac9f19f4ec84aa5b /llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | |
parent | caa32e6d6fec4c77d47f85d866e23b4c0e2501a0 (diff) | |
download | llvm-8f25c0bc7d59a65f27faa88d7debc47275a3a3da.zip llvm-8f25c0bc7d59a65f27faa88d7debc47275a3a3da.tar.gz llvm-8f25c0bc7d59a65f27faa88d7debc47275a3a3da.tar.bz2 |
[clang] Fix covariant cv-qualification check to require the override function return type to have the same or less cv-qualification (#112713)
This prevents changing cv-qualification from const to volatile or vice
versa, for example.
https://eel.is/c++draft/class.virtual#8.3
Previously, we checked that the new type is the same or more qualified
to return an error, but the standard requires the new type to be the
same or less qualified and since the cv-qualification is only partially
ordered, we cannot rely on a check on whether it is more qualified to
return an error. Now, we reversed the condition to check whether the old
is at least as qualified, and return an error if it is not.
Also, adjusted the error name and message to clarify the requirement and
added a missing closing parenthesis.
Added tests to cover different use cases for classes with different
qualifications and also refactored them to make them easier to follow:
1. Use override to make sure the function names actually match.
2. Named the function in a more descriptive way to clarify what each use
case is checking.
Fixes: #111742
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp')
0 files changed, 0 insertions, 0 deletions