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

            Bug ID: 81860
           Summary: Call to undefined inline function involving inheriting
                    constructors
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wielkiegie at gmail dot com
  Target Milestone: ---

Created attachment 41987
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41987&action=edit
Minimized test case that reproduces the issue

It seems that gcc forgets to emit or inline an empty inline constructor when
the following are used:
1. An empty template class A with empty constructor A() {} that is the one that
is missed
2. A class B with a template constructor (doesn't matter what is templated)
that accepts an object of class A with a default argument A() and stores it
inside of itself
3. A class C that derives from class B and uses inheriting constructors

Attached is a test-case for this.

$ g++ test-case3.cpp
/tmp/ccoFntWy.o: In function `main':
test-case3.cpp:(.text+0x11): undefined reference to `A<unsigned int>::A()'
collect2: error: ld returned 1 exit status

The problem does occur on gcc 7 and the newest snapshot (tested on godbolt). It
does not occur on gcc 6 and gcc 5. As such, it's a regression that first occurs
in gcc 7.

Reply via email to