Hmm, how's this? About all that CXXConstructExpr currently does is invalidate arguments. The only difference between CXXConstructExpr and CXXTemporaryObjectExpr is some source type information and that CXXTemporaryObjectExpr's have none or more than one argument. So, this test verifies that the constructor is handled by the engine now and verifies that arguments are invalidated.

 - jim

Index: test/Analysis/misc-ps-cxx0x.cpp
===================================================================
--- test/Analysis/misc-ps-cxx0x.cpp    (revision 141126)
+++ test/Analysis/misc-ps-cxx0x.cpp    (working copy)
@@ -9,3 +9,27 @@
   *p = 0xDEADBEEF; // expected-warning {{null}}
 }

+// Tests for CXXTemporaryObjectExpr.
+struct X {
+    X( int *ip, int );
+};
+
+// Test to see if CXXTemporaryObjectExpr is being handled.
+int tempobj1()
+{
+  int j;
+  int i;
+  X a = X( &j, 1 );
+
+ return i; // expected-warning {{Undefined or garbage value returned to caller}}
+}
+
+// Test to see if CXXTemporaryObjectExpr invalidates arguments.
+int tempobj2()
+{
+  int j;
+  X a = X( &j, 1 );
+
+  return j; // no-warning
+}
+


On 10/4/2011 3:21 PM, Ted Kremenek wrote:
Test case please.  :)

Index: test/Analysis/misc-ps-cxx0x.cpp
===================================================================
--- test/Analysis/misc-ps-cxx0x.cpp     (revision 141126)
+++ test/Analysis/misc-ps-cxx0x.cpp     (working copy)
@@ -9,3 +9,27 @@
   *p = 0xDEADBEEF; // expected-warning {{null}}
 }
 
+// Tests for CXXTemporaryObjectExpr.
+struct X {
+    X( int *ip, int );
+};
+
+// Test to see if CXXTemporaryObjectExpr is being handled.
+int tempobj1()
+{
+  int j;
+  int i;
+  X a = X( &j, 1 );
+
+  return i; // expected-warning {{Undefined or garbage value returned to 
caller}}
+}
+
+// Test to see if CXXTemporaryObjectExpr invalidates arguments.
+int tempobj2()
+{
+  int j;
+  X a = X( &j, 1 );
+
+  return j; // no-warning
+}
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to