-
Notifications
You must be signed in to change notification settings - Fork 0
induce errors #9
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
base: main
Are you sure you want to change the base?
Changes from all commits
0322a18
424326d
322fb47
fa31cd6
ef0131c
16ce973
637f7aa
66b8d78
4cb05d1
d26378d
43ce561
8cd7a27
c99cb8c
532dff4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,10 +1,28 @@ | ||||||
| #include <iostream> | ||||||
| #include <string> | ||||||
|
|
||||||
| #include <boost/format.hpp> | ||||||
| class X | ||||||
| { | ||||||
| std::string m_string; | ||||||
| public: | ||||||
| X(const std::string& str) : m_string(str) {} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [hicpp-explicit-conversions]
Suggested change
|
||||||
|
|
||||||
| std::string | ||||||
| get_string() | ||||||
| { | ||||||
| return m_string; | ||||||
| } | ||||||
| }; | ||||||
|
|
||||||
| std::string hello() | ||||||
| { | ||||||
| std::string const str = "hello"; | ||||||
| X x(str); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable name 'x' is too short, expected at least 3 characters [readability-identifier-length] X x(str);
^ |
||||||
| return x.get_string(); | ||||||
| } | ||||||
|
|
||||||
| int main() | ||||||
| { | ||||||
| std::cout << "hello" << std::endl; | ||||||
| std::cout << hello() << '\n'; | ||||||
| return 0; | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: pass by value and use std::move [modernize-pass-by-value]
src/hello.cpp:2:
+ #include <utility>