CCMenu initialize empty menu

Is it by design that you cannot initialize an empty CCMenu and then add to it later using addChild()?

To initialize a new menu I need to give it atleast one item, otherwise it will fail.

CCMenu* menu = CCMenu::node();
menu~~>addChild;
menu~~>addChild(item2, 1);
menu~~>addChild;
“Run-Time Check Failure #3 - The variable ‘args’ is being used without being initialized.”

The following works fine.
CCMenu* menu = CCMenu::menuWithItems;
This works fine, too:
CCMenu* menu = CCMenu::menuWithItem;
menu~~>addChild(item2, 1);
menu->addChild(item3, 1);

yeap, this is a bug, Bug #756 has been created, thank you.

CCMenu* menu = CCMenu::menuWithItem(NULL)
menu~~>addChild;
menu~~>addChild(item2, 1);
menu->addChild(item3, 1);

it should work!

The fix is trivial - when using CCMenu::node(), the va_list variable is uninitialised (hence the run-time check failure).

The corrected code for this method is:

bool CCMenu::init()
{
va_list args=NULL;
return initWithItems(NULL, args);
}

Hi, Rocco Loscalzo,
Thanks, your patch code have been merged in latest source, refer to https://github.com/cocos2d/cocos2d-x/pull/688.