GCC 8.1: Assembler error with lambda default argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all.

I'm testing my codebase with GCC 8.1 (built myself) and am running into
a couple if issues.  Note I was able to compile and run OK with GCC 7.3
FYI.  This is on a GNU/Linux x86_64 system and I'm using binutils 2.30,
and compiling with -O2 -g -Wall -Werror (and a few other things).

My second issue is very odd: I have a template function which takes a
std::function<> reference as an argument, it is defined in the header
with a default value which is a lambda.  The header declaration looks
like this:

namespace foo {
    template<typename T>
    void getMatching(const Ex*
expr, std::vector<T*>& nodes,
        const std::function<bool(const Ex*
n)>& prune
            = [](const Ex* e) { return false; });
}

then it's defined like this:

namespace foo {
    template<typename T>
    void getMatching(const Ex* expr, std::vector<T*>& nodes,
        const std::function<bool(const Ex* n)>& prune)
    {
        ...
    }
}

This worked fine with GCC 6.x and 7.x, but in 8.1 I get an error from
the assembler (not compiler):

/tmp/ccaCrEir.s: Assembler messages:
/tmp/ccaCrEir.s:2379: Error: symbol `...' is already defined
/tmp/ccaCrEir.s: Error: .size expression for ... does not evaluate to a constant

If I use a function (even inline) rather than a lambda, then it works:

namespace foo {
    inline bool defaultPruneCond(const Ex* e) { return
false; }

    template<typename T>
    void getMatching(const Ex* expr, std::vector<T*>& nodes,
        const std::function<bool(const Ex* n)>& prune
            = defaultPruneCond);
}




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux