summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test/unnecessaryparen.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/test/unnecessaryparen.cxx')
-rw-r--r--compilerplugins/clang/test/unnecessaryparen.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/unnecessaryparen.cxx b/compilerplugins/clang/test/unnecessaryparen.cxx
index ccc2b4ce6556..89ca84da6ab2 100644
--- a/compilerplugins/clang/test/unnecessaryparen.cxx
+++ b/compilerplugins/clang/test/unnecessaryparen.cxx
@@ -7,6 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <cstddef>
#include <memory>
#include <string>
#include <rtl/ustring.hxx>
@@ -34,6 +35,13 @@ template <> struct typed_flags<BrowseMode> : is_typed_flags<BrowseMode, 0xf>
};
}
+void f(char const *);
+char const * operator ""_s1(char const *, std::size_t);
+#if __cplusplus >= 202002L
+struct Str { constexpr Str(char const *) {} };
+template<Str> char const * operator ""_s2();
+#endif
+
int main()
{
int x = 1;
@@ -115,6 +123,21 @@ int main()
(void)nBits;
OUString::number((v2+1)); // expected-error {{parentheses immediately inside single-arg call [loplugin:unnecessaryparen]}}
+
+ (void) ("foo"); // expected-error {{unnecessary parentheses around single-token string literal [loplugin:unnecessaryparen]}}
+ (void) ("foo" "bar");
+ f(("foo")); // expected-error {{parentheses immediately inside single-arg call [loplugin:unnecessaryparen]}}
+ f(("foo" "bar"));
+ (void) ("foo"_s1); // expected-error {{unnecessary parentheses around single-token string literal [loplugin:unnecessaryparen]}}
+ (void) ("foo" "bar"_s1);
+ f(("foo"_s1)); // expected-error {{parentheses immediately inside single-arg call [loplugin:unnecessaryparen]}}
+ f(("foo" "bar"_s1));
+#if __cplusplus >= 202002L
+ (void) ("foo"_s2); //TODO: expected error {{unnecessary parentheses around single-token string literal [loplugin:unnecessaryparen]}}
+ (void) ("foo" "bar"_s2);
+ f(("foo"_s2)); // TODO: expected error {{parentheses immediately inside single-arg call [loplugin:unnecessaryparen]}}
+ f(("foo" "bar"_s2));
+#endif
};
struct B { operator bool() const; };