#include <iostream>
using std::cout;
using std::endl;
extern int NODATA;
auto size = sizeof(NODATA);
auto align = alignof(NODATA);
void f(int c = NODATA)
{
cout << "c=" << c << endl;
}
decltype(NODATA) main()
{
cout << "size=" << size << endl;
cout << "align=" << align << endl;
f(0);
// above here should all work, below may not depending on
// implementation and its optimization settings
if(false && NODATA)
{
cout << "false && NODATA" << endl;
}
else if(true || NODATA)
{
cout << "true || NODATA" << endl;
}
else
{
int i = NODATA;
}
// this would definitely cause a linker error
// f();
// but this may not
false ? f() : f(1);
f((NODATA-NODATA) + 2);
//not optimized out by ideone.com's version gcc with whatever flags are set
//f((NODATA/NODATA) + 2);
//f((4*NODATA)/NODATA);
//"sorry, unimplemented: non-trivial designated initializers not supported"
//int arry[3] = { [0] = 1, [1] = NODATA, [1] = 2 };
//"sorry, unimplemented: non-trivial designated initializers not supported"
//struct {
// int first;
// int second;
// int third;
//} strct = {.first = 1, .second = NODATA, .second = 2};
return NODATA^NODATA;
int i = NODATA;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBzdGQ6OmNvdXQ7CnVzaW5nIHN0ZDo6ZW5kbDsKIApleHRlcm4gaW50IE5PREFUQTsKIAphdXRvIHNpemUgPSBzaXplb2YoTk9EQVRBKTsKYXV0byBhbGlnbiA9IGFsaWdub2YoTk9EQVRBKTsKIAp2b2lkIGYoaW50IGMgPSBOT0RBVEEpCnsKICAgIGNvdXQgPDwgImM9IiA8PCBjIDw8IGVuZGw7Cn0KIApkZWNsdHlwZShOT0RBVEEpIG1haW4oKQp7CiAgICBjb3V0IDw8ICJzaXplPSIgPDwgc2l6ZSA8PCBlbmRsOwogICAgY291dCA8PCAiYWxpZ249IiA8PCBhbGlnbiA8PCBlbmRsOwogCiAgICBmKDApOwogCiAgICAvLyBhYm92ZSBoZXJlIHNob3VsZCBhbGwgd29yaywgYmVsb3cgbWF5IG5vdCBkZXBlbmRpbmcgb24gCiAgICAvLyBpbXBsZW1lbnRhdGlvbiBhbmQgaXRzIG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