http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59949

            Bug ID: 59949
           Summary: default value to std::function template function
                    parameter causes »already defined« messages in
                    assembler
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: moritz at bunkus dot org

Created attachment 31954
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31954&action=edit
sample file causing the bug

I have a template function that takes an std::function argument. This argument
has a default value, an in-place declared lambda function. As soon as I use
that template function more than once with different types within a compilation
unit I receive error messages from the assembler about symbols that are defined
already.

I've distilled it down to a code snippet I'm going to attach. In the original
code the lambda function was actually using the template parameter T and could
therefore not be converted to standalone function.

This fails with 4.8 and 4.8.2, but I remember it failing back as early as
4.6.3.

It works nicely with clang++ 3.3 and 3.4. With »works nicely« I mean that it
compiles cleanly, links, and the resulting code does what I want it to (in my
original source; this sample code obviously doesn't do anything at all).

The command line used:

g++ -std=c++11 -o cpp1 cpp1.cpp

Reply via email to