Quick C++ question for C++ experts :)

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

 



Is this expected to not compile with -fno-implicit-templates?

---%<---
$ cat test.cc
#include <string>
std::string test(int i)
{
    std::string t;
    std::string s = "(";
    t = "";
    for (int r = i; r; r>>=1) {
        if (r & 1)
            t = "1" + t;
        else
            t = "0" + t;
    }
    s += t;
    s += ")";
    return s;
}

int
main(int argc, char *argv[])
{
    std::string s = test(16);
    return 0;
}

$ g++ -fno-implicit-templates test.cc
/tmp/ccai7t5T.o: In function `test(int)':
test.cc:(.text+0x9d): undefined reference to
`std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > std::operator+<char, std::char_traits<char>,
std::allocator<char> >(char const*, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
test.cc:(.text+0xd9): undefined reference to
`std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > std::operator+<char, std::char_traits<char>,
std::allocator<char> >(char const*, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
---%<---

I am trying to fix a package, but it is documented to
require -fno-implicit-templates and instantiate templates
in one of the sources, but it instantiates templates for
its own types.

Thanks,
Paulo
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux