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

Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arthur.j.odwyer at gmail dot 
com

--- Comment #11 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> ---
Is there a workaround available for GCC 4.6.3?
That is, I have some code that looks like

class A {
    static A *unwrap(void *p);
    static void api_helper(void *p) { A *a = unwrap(p); ... }
    void init() { register_with_api(&api_helper); }
};

where "api_helper" exists only to conform to the requirements of the external
API.
To reduce the surface area of the class, I'd like to refactor this into
something like

class A {
    static A *unwrap(void *p);
    void init() {
        auto api_helper = [](void *a) { A *a = unwrap(p); ... };
        register_with_api(api_helper);
    }
};

but at the moment I'm hitting this bug in gcc (Ubuntu/Linaro 4.6.3-1ubuntu5)
4.6.3 because "api_helper" happens to also want to use some static members of
A.

I understand if there's no workaround (beyond "upgrade to gcc 4.8"), but if
there IS one, I'd like to know it!

Reply via email to