summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/test')
-rw-r--r--compilerplugins/clang/test/stringadd.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/stringadd.cxx b/compilerplugins/clang/test/stringadd.cxx
index fb805ce519b9..a20b64698433 100644
--- a/compilerplugins/clang/test/stringadd.cxx
+++ b/compilerplugins/clang/test/stringadd.cxx
@@ -235,4 +235,28 @@ void f2(char ch)
s = s + OString(ch);
}
}
+
+namespace test10
+{
+struct C
+{
+ OString constStringFunction(int) const;
+ OString nonConstStringFunction();
+ int constIntFunction() const;
+ int nonConstIntFunction();
+};
+
+C getC();
+
+void f1(C c)
+{
+ OString s;
+ // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}}
+ s += c.constStringFunction(c.constIntFunction());
+ s += c.constStringFunction(c.nonConstIntFunction());
+ s += c.nonConstStringFunction();
+ s += getC().constStringFunction(c.constIntFunction());
+}
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */