[llvm-bugs] [Bug 31379] error: instantiation of function required here, but no definition is available

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 14 21:22:04 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31379

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
Thank you for the bug report!

The warning is correct, and is detecting exactly the problem it was designed to
detect.

The definition of message::message() at message.cpp:44 causes the generation of
the default constructor of message::property_map, which triggers the
instantiation of the default constructor of internal::cached_map<std::string,
scalar>.

But the default constructor of the internal::cached_map template is not defined
in this file, so it will not be instantiated. The program is therefore
ill-formed (no diagnostic required) unless that template is explicitly
instantiated for that set of template arguments somewhere else. (And if not, in
practice whether or not it works depends on how lucky you get: if the default
constructor is instantiated in some other source file, the program will
typically happen to work unless every use of it is inlined.)

The warning can be suppressed by using an explicit instantiation declaration,
explicitly stating the intent to explicitly instantiate that template somewhere
else.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161215/b9fa9a02/attachment.html>


More information about the llvm-bugs mailing list