OSX + Clang does not print dolfin_assert message string

Issue #6 resolved
Prof Garth Wells created an issue

dolfin_assert should print a message as it eventually calls

throw std::runtime_error(s.str());

I've checked that s.str() is correct, but std::runtime_error fails to print the message with Xcode 4.6.1 (clang Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn).

Sample code below reproduces problem. Isn't necessarily a DOLFIN bug, but a work around is desirable.

#include <dolfin.h> using namespace dolfin; int main() { dolfin_assert(1 == 2); return 0; }

Comments (3)

  1. Jack Hale

    I wondered why my error messages weren't working.

    Actually I get the same problem using macports gcc 4.7 so this isn't limited to clang. This is from a dolfin 1.2.0 build compiled a few days ago using dorsal and macports. Is something catching the exception and making it silent perhaps?

    On a tangentially related note with using DOLFIN on Mac, even though I have selected gcc-4.7 as my compiler of choice using macports, when I see instant doing the configure/compile step with cmake it always uses clang. All in all I'm a little confused over what is the recommended compiler on Mac and whether this mixing and matching of toolchains could cause issues.

  2. Log in to comment