[cfe-dev] A trivial test case requires guard variable but it need not

jahanian fjahanian at apple.com
Mon Feb 13 15:09:45 PST 2012


Hi,

I am not sure which of the recent patches related to recent c++11 initializer work caused this. 
In this trivial test case, clang now generates a guard variable. It need not. This breaks several 
of our projects which do not  need (must not have) guard variable.


class IOService;

struct IOSurfaceSendRight { void foo(); };

typedef int (IOService::*IOMethod)();

void a() {
  static IOMethod x = (IOMethod)&IOSurfaceSendRight::foo;
}

% clang -c test.cpp

% nm -nm test.o | grep guard
                 (undefined) external ___cxa_guard_acquire
                 (undefined) external ___cxa_guard_release

% nm -nm test.o | grep guard
                 (undefined) external ___cxa_guard_acquire
                 (undefined) external ___cxa_guard_release



More information about the cfe-dev mailing list