mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Resolve issues relating to compilation with clang-3.5.0
This commit is contained in:
3
applications/test/nullObject/Make/files
Normal file
3
applications/test/nullObject/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-nullObject.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/nullObject
|
||||
0
applications/test/nullObject/Make/options
Normal file
0
applications/test/nullObject/Make/options
Normal file
70
applications/test/nullObject/Test-nullObject.C
Normal file
70
applications/test/nullObject/Test-nullObject.C
Normal file
@ -0,0 +1,70 @@
|
||||
#include "nullObject.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
class SimpleClass
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Null constructor
|
||||
SimpleClass()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
// Test pointer and reference to a class
|
||||
|
||||
SimpleClass* ptrToClass = new SimpleClass;
|
||||
SimpleClass& refToClass(*ptrToClass);
|
||||
|
||||
if (notNull(ptrToClass))
|
||||
{
|
||||
Info<< "Pass: ptrToClass is not null" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "FAIL: refToClass is null" << endl;
|
||||
}
|
||||
|
||||
if (notNull(refToClass))
|
||||
{
|
||||
Info<< "Pass: refToClass is not null" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "FAIL: refToClass is null" << endl;
|
||||
}
|
||||
|
||||
|
||||
// Test pointer and reference to the nullObject
|
||||
|
||||
const SimpleClass* ptrToNull(NullObjectPtr<SimpleClass>());
|
||||
const SimpleClass& refToNull(*ptrToNull);
|
||||
|
||||
if (isNull(ptrToNull))
|
||||
{
|
||||
Info<< "Pass: ptrToNull is null" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "FAIL: ptrToNull is not null" << endl;
|
||||
}
|
||||
|
||||
if (isNull(refToNull))
|
||||
{
|
||||
Info<< "Pass: refToNull is null" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "FAIL: refToNull is not null" << endl;
|
||||
}
|
||||
|
||||
// Clean-up
|
||||
delete ptrToClass;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user