This is on 64-bit linux.
Valgrind output:
==4057== Memcheck, a memory error detector
==4057== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==4057== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==4057== Command: ./foo
==4057==
==4057== Invalid read of size 8
==4057== at 0x4EC68C8: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) (in /usr/lib/libstdc++.so.6.0.9)
==4057== by 0x4075E0: CopyConstructString(std::string const&, std::string*) (scriptstdstring.cpp:125)
==4057== by 0x449A5F: X64_CallFunction(unsigned long const*, int, unsigned long (*)(), unsigned long&, bool) (as_callfunc_x64_gcc.cpp:142)
==4057== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==4057==
==4057==
==4057== Process terminating with default action of signal 11 (SIGSEGV)
==4057== Access not within mapped region at address 0x0
==4057== at 0x4EC68C8: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) (in /usr/lib/libstdc++.so.6.0.9)
==4057== by 0x4075E0: CopyConstructString(std::string const&, std::string*) (scriptstdstring.cpp:125)
==4057== by 0x449A5F: X64_CallFunction(unsigned long const*, int, unsigned long (*)(), unsigned long&, bool) (as_callfunc_x64_gcc.cpp:142)
==4057== If you believe this happened as a result of a stack
==4057== overflow in your program's main thread (unlikely but
==4057== possible), you can try to increase the size of the
==4057== main thread stack using the --main-stacksize= flag.
==4057== The main thread stack size used in this run was 8388608.
==4057==
==4057== HEAP SUMMARY:
==4057== in use at exit: 67,922 bytes in 366 blocks
==4057== total heap usage: 766 allocs, 400 frees, 90,995 bytes allocated
==4057==
==4057== LEAK SUMMARY:
==4057== definitely lost: 0 bytes in 0 blocks
==4057== indirectly lost: 0 bytes in 0 blocks
==4057== possibly lost: 35 bytes in 1 blocks
==4057== still reachable: 67,887 bytes in 365 blocks
==4057== suppressed: 0 bytes in 0 blocks
==4057== Rerun with --leak-check=full to see details of leaked memory
==4057==
==4057== For counts of detected and suppressed errors, rerun with: -v
==4057== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 5 from 5)
Code attached.