Author: jrose
Date: Fri Jun 15 13:19:43 2012
New Revision: 158530

URL: http://llvm.org/viewvc/llvm-project?rev=158530&view=rev
Log:
Test that -Wauto-var-id fires in value-dependent contexts.

There was already a test that it did not fire in type-dependent contexts.
This was already behaving correctly.

Modified:
    cfe/trunk/test/SemaObjCXX/arc-0x.mm

Modified: cfe/trunk/test/SemaObjCXX/arc-0x.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/arc-0x.mm?rev=158530&r1=158529&r2=158530&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/arc-0x.mm (original)
+++ cfe/trunk/test/SemaObjCXX/arc-0x.mm Fri Jun 15 13:19:43 2012
@@ -60,15 +60,21 @@
   auto x = obj; // expected-warning{{'auto' deduced as 'id' in declaration of 
'x'}}
 }
 
+@interface Array
++ (instancetype)new;
+- (id)objectAtIndex:(int)index;
+@end
+
 // ...but don't warn if it's coming from a template parameter.
-template<typename T>
-void autoTemplateFunction(T param, id obj) {
+template<typename T, int N>
+void autoTemplateFunction(T param, id obj, Array *arr) {
   auto x = param; // no-warning
   auto y = obj; // expected-warning{{'auto' deduced as 'id' in declaration of 
'y'}}
+  auto z = [arr objectAtIndex:N]; // expected-warning{{'auto' deduced as 'id' 
in declaration of 'z'}}
 }
 
 void testAutoIdTemplate(id obj) {
-  autoTemplateFunction(obj, obj); // no-warning
+  autoTemplateFunction<id, 2>(obj, obj, [Array new]); // no-warning
 }
 
 


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to