public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/68070] New: Undefined reference to default constructor of member template class
@ 2015-10-23 14:19 frrrwww at gmail dot com
2015-10-25 1:59 ` [Bug c++/68070] " redi at gcc dot gnu.org
2021-08-12 2:17 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: frrrwww at gmail dot com @ 2015-10-23 14:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68070
Bug ID: 68070
Summary: Undefined reference to default constructor of member
template class
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: frrrwww at gmail dot com
Target Milestone: ---
Hello,
When compiling the following simple program with `g++ prog.cc -Wall -Wextra
-std=c++14`
-----
#include <vector>
template<typename Value>
struct A
{
A() = default;
std::vector<Value> m_content;
};
void func(A<int> a = {})
{
}
int main()
{
func();
}
-----
We get the following error:
-----
/tmp/ccr6nbUo.o: In function `main':
prog.cc:(.text+0x1b): undefined reference to `std::vector<int,
std::allocator<int> >::vector()'
collect2: error: ld returned 1 exit status
-----
That error happens on gcc 4.9, 5.2 and 6.0, it does not happen on clang for
this specific code.
An alternative version of the code:
-----
#include <vector>
template<typename Value>
struct A
{
A() = default;
A(int) {}
std::vector<Value> m_content;
};
struct B { A<int> a; };
void func(B b = {})
{
}
int main()
{
func();
}
-----
gets this error:
-----
/tmp/ccvOFE5O.o: In function `main':
prog.cc:(.text+0x33): undefined reference to `A<int>::A()'
collect2: error: ld returned 1 exit status
-----
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/68070] Undefined reference to default constructor of member template class
2015-10-23 14:19 [Bug c++/68070] New: Undefined reference to default constructor of member template class frrrwww at gmail dot com
@ 2015-10-25 1:59 ` redi at gcc dot gnu.org
2021-08-12 2:17 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2015-10-25 1:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68070
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-10-25
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/68070] Undefined reference to default constructor of member template class
2015-10-23 14:19 [Bug c++/68070] New: Undefined reference to default constructor of member template class frrrwww at gmail dot com
2015-10-25 1:59 ` [Bug c++/68070] " redi at gcc dot gnu.org
@ 2021-08-12 2:17 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12 2:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68070
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 82336.
*** This bug has been marked as a duplicate of bug 82336 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-12 2:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-23 14:19 [Bug c++/68070] New: Undefined reference to default constructor of member template class frrrwww at gmail dot com
2015-10-25 1:59 ` [Bug c++/68070] " redi at gcc dot gnu.org
2021-08-12 2:17 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).