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

            Bug ID: 63876
           Summary: static data members of template classes w/ default
                    ctors gives "undefined reference" error
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aleaverfay at gmail dot com

Created attachment 33973
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33973&action=edit
.cc, .hh, and .ii files along with the compilation command

Static data members of template classes that use default constructors don't
seem to get  symbols emitted for them.

I have a case where I cannot use anything besides the default constructor for
this static data member: std::mutex.

I've created a small test case that gives me the same problem.

gcc version: 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
system type: Ubuntu 14.04.1
(I don't know what options were given to g++ when it was built; how do I find
that out?)
command line: (also in attachment) 

g++ -std=c++0x main.cc test.cc -I.

compiler output:

/tmp/cci1VgZe.o: In function `Foo::set_bar(int)':
test.cc:(.text+0x86): undefined reference to `CRTP_class<Foo>::mutex_'
collect2: error: ld returned 1 exit status

Reply via email to