aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/conversion-function.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-04-13 00:04:31 +0000
committerJohn McCall <rjmccall@apple.com>2010-04-13 00:04:31 +0000
commita3f8137d9f7cd1af7a6cbe736b9419f7eb99e86c (patch)
tree3538911a019548d669fa76c0f10ef3bf3a77d737 /test/SemaCXX/conversion-function.cpp
parent88aae9188a64fe6385c7057af068aaeb8fc96b8e (diff)
Diagnose declarations of conversion functions with declarators other than '()'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/conversion-function.cpp')
-rw-r--r--test/SemaCXX/conversion-function.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp
index 381cd60d40..972409ca5a 100644
--- a/test/SemaCXX/conversion-function.cpp
+++ b/test/SemaCXX/conversion-function.cpp
@@ -165,3 +165,14 @@ namespace source_locations {
E2<int&> e2i; // expected-note{{in instantiation}}
}
+
+namespace crazy_declarators {
+ struct A {
+ (&operator bool())(); // expected-error {{must use a typedef to declare a conversion to 'bool (&)()'}}
+
+ // FIXME: This diagnostic is misleading (the correct spelling
+ // would be 'operator int*'), but it's a corner case of a
+ // rarely-used syntax extension.
+ *operator int(); // expected-error {{must use a typedef to declare a conversion to 'int *'}}
+ };
+}