// This test verifies that we get nice warning if a method on null ptr object is
// This test verifies that we get nice warning if a method on null ptr object is
// called.
// called.
// XFAIL:*
extern"C"intprintf(constchar*fmt,...);
extern"C"intprintf(constchar*fmt,...);
classMyClass{
classMyClass{
private:
private:
...
@@ -19,7 +19,7 @@ public:
...
@@ -19,7 +19,7 @@ public:
intgetA(){returna;}
intgetA(){returna;}
};
};
MyClass*my=0;
MyClass*my=0;
my->getA()// expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
my->getA()// expected-warning {{null passed to a callee that requires a non-null argument}}
structAggregatedNull{
structAggregatedNull{
MyClass*m;
MyClass*m;
...
@@ -27,6 +27,6 @@ struct AggregatedNull {
...
@@ -27,6 +27,6 @@ struct AggregatedNull {
}
}
AggregatedNullagrNull;
AggregatedNullagrNull;
agrNull.m->getA();// expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
agrNull.m->getA();// expected-warning {{null passed to a callee that requires a non-null argument}}