diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-07-30 17:59:29 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-07-31 16:29:45 +0200 |
commit | 6b962889b2581ed67e20e4f3028757859361c28e (patch) | |
tree | 9de8b661165ca7dfa2b8de2ec0c54ced397b82e3 /compilerplugins/clang/test/stringconstant.cxx | |
parent | 98c0cefb18d8af7aa4732708ba0ae6be2e808d6f (diff) |
Improved loplugin:stringconstant (now that GCC 7 supports it)
Change-Id: I8f83c1941b8f39b261005939f4dcf3577ae9fc6f
Reviewed-on: https://gerrit.libreoffice.org/76702
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/test/stringconstant.cxx')
-rw-r--r-- | compilerplugins/clang/test/stringconstant.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/stringconstant.cxx b/compilerplugins/clang/test/stringconstant.cxx index 49ae3b68d035..066648c8871d 100644 --- a/compilerplugins/clang/test/stringconstant.cxx +++ b/compilerplugins/clang/test/stringconstant.cxx @@ -28,6 +28,30 @@ struct Foo2 { void foo(OString const &) const {} }; +OString ret1() { + return OString("foo"); // expected-error {{elide constructor call [loplugin:stringconstant]}} +} + +OString const ret2() { + return OString("foo"); // expected-error {{elide constructor call [loplugin:stringconstant]}} +} + +auto ret3() { + return OString("foo"); +} + +OUString ret4() { + return OUString("foo"); // expected-error {{elide constructor call [loplugin:stringconstant]}} +} + +OUString const ret5() { + return OUString("foo"); // expected-error {{elide constructor call [loplugin:stringconstant]}} +} + +auto ret6() { + return OUString("foo"); +} + int main() { char const s1[] = "foo"; char const * const s2 = "foo"; |