summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-06-17 23:16:24 +0000
committerDouglas Gregor <dgregor@apple.com>2011-06-17 23:16:24 +0000
commitd7357a9b8e3d3ffff505ef767081e042b8ef5e24 (patch)
treeffc4b5dbb8a9a41a3887ea2f56831907e2a98b4a /clang/test
parent157e6a79a1f4ccd9863a4110c09d9b7e5f38f127 (diff)
downloadbcm5719-llvm-d7357a9b8e3d3ffff505ef767081e042b8ef5e24.tar.gz
bcm5719-llvm-d7357a9b8e3d3ffff505ef767081e042b8ef5e24.zip
Objective-C++ ARC: eliminate the utterly unjustified loophole that
silently dropped ownership qualifiers that were being applied to ownership-qualified, substituted type that was *not* a substituted template type parameter. We now provide a diagnostic in such cases, and recover by dropping the added qualifiers. Document this behavior in the ARC specification. llvm-svn: 133309
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaObjCXX/arc-templates.mm10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaObjCXX/arc-templates.mm b/clang/test/SemaObjCXX/arc-templates.mm
index 3711bd72df2..73fc314e0e3 100644
--- a/clang/test/SemaObjCXX/arc-templates.mm
+++ b/clang/test/SemaObjCXX/arc-templates.mm
@@ -94,6 +94,16 @@ int check_make_weak0[is_same<make_weak<id>::type, __weak id>::value? 1 : -1];
int check_make_weak1[is_same<make_weak<__strong id>::type, __weak id>::value? 1 : -1];
int check_make_weak2[is_same<make_weak<__autoreleasing id>::type, __weak id>::value? 1 : -1];
+template<typename T>
+struct make_weak_fail {
+ typedef T T_type;
+ typedef __weak T_type type; // expected-error{{the type 'T_type' (aka '__weak id') already has retainment attributes set on it}} \
+ // expected-error{{the type 'T_type' (aka '__strong id') already has retainment attributes set on it}}
+};
+
+int check_make_weak_fail0[is_same<make_weak_fail<__weak id>::type, __weak id>::value? 1 : -1]; // expected-note{{in instantiation of template class 'make_weak_fail<__weak id>' requested here}}
+
+int check_make_weak_fail1[is_same<make_weak_fail<id>::type, __weak id>::value? -1 : 1]; // expected-note{{in instantiation of template class 'make_weak_fail<id>' requested here}}
// Check template argument deduction from function templates.
template<typename T> struct identity { };
OpenPOWER on IntegriCloud