Problem with Builder pattern and template in release mode

Here is a prequel of a story.problem
I found the reason behind but i couldnt find the solution. I am relatively new to c++.
At the beginning of my cocos2d-x experience, i decided to write a builder class for my ui objects and it worked fine on debug mode and i never suspected about my code. here is my code:

github gist

There are sample calls of a class in a link also.
Probably the problem is related to stack management difference on debug and release modes.
How can i correct the mistake with minimum effort? or can i solve it with this approach?