https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83730

--- Comment #6 from Wilhelm M <klaus.doldinger64 at googlemail dot com> ---
This is still true for local statics as shown below:


// Test für guard variable 

struct A {
    inline A(int v = 0) {} // without user-defined ctors, guards are omitted
    int m1() const {
        return m;
    }
private:
    int m = 0;
};

//namespace { // without anon-ns guards, are generated 
    template<typename T>
    struct X {
        static int foo() {
            static T m; // even as local-static and -fno-threadsafe-statics,
guards are generated  
            return m.m1();
        }
//        inline static T m;  
    };
//}

int main() {
    return X<A>::foo();    
}

Reply via email to