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

False positive readability-redundant-string-init for default arguments #27461

Closed
JVApen opened this issue Mar 26, 2016 · 2 comments
Closed

False positive readability-redundant-string-init for default arguments #27461

JVApen opened this issue Mar 26, 2016 · 2 comments
Labels
bugzilla Issues migrated from bugzilla clang-tidy

Comments

@JVApen
Copy link

JVApen commented Mar 26, 2016

Bugzilla Link 27087
Resolution FIXED
Resolved on Apr 07, 2016 10:58
Version unspecified
OS Linux
Attachments Reproduction
CC @hokein

Extended Description

#include
void fn(std::string a = "");

The readability-redundant-string-init check tells me that the string 'a' has redundant string initialization. However, if I remove this, the code no longer compiles in the large picture, as I have callers of fn() without this string argument.

I've currently changed my code to: void fn(std::string a = std::string{});
This is most likely the better way of writing this code, however I still need to initialize a, hence the init is not redundant.

Note: clang-tidy has been build with rev264514.

PS: I've also noticed that this checker doesn't cover the init-list of a constructor, don't know if that is already worth logging a bug for.

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 6, 2016

Patch here:
http://reviews.llvm.org/D18829

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 7, 2016

fixed:
http://reviews.llvm.org/rL265671

@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 clang-tidy
Projects
None yet
Development

No branches or pull requests

2 participants