You cannot initialize tst_ where you declare it. This can only be done for primitive static const types. Instead, you'll need a constructor for test1.
EDIT: here is a working example at ideone.com . Pay attention to some changes that I made - at first it is better that the test constructor accepts a const reference to a string in order to avoid copying. Second - if the program succeeds, you should return 0 not 1 (with a return of 1 you will get a runtime error in ideone )
Ivaylo strandjev
source share