public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors
@ 2012-11-09 10:24 antoshkka at gmail dot com
  2012-11-09 10:25 ` [Bug c++/55249] " antoshkka at gmail dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: antoshkka at gmail dot com @ 2012-11-09 10:24 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

             Bug #: 55249
           Summary: Multiple copy constructors for template class lead to
                    link errors
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: antoshkka@gmail.com


Created attachment 28647
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28647
gcc -v -save-temps -std=c++0x -Wall -Wextra main.cpp 1>output.txt 2>&1

Following code leads to linker errors in C++11 mode and in default mode
(requires replacement of std::array with boost::array):

#include <array>
#include <vector>

template <class TypeT>
struct inner_type {

    inner_type() {}
    inner_type(inner_type& ) {}
    inner_type(const inner_type& ) {}

    ~inner_type() {}
};

// Uncomment typedef to get undefined reference to 
// __uninitialized_copyILb0EE13__uninit_copy
// Can be workaround by marking inner_type copy constructors with noexcept
//typedef std::vector<std::array<inner_type<int>, 3> > type;

// Uncomment typedef to get undefined reference to 
// `inner_type<int>::inner_type(inner_type<int> const&)'
//typedef std::array<inner_type<int>, 3> type;

int main()
{
    type t1;
    type t2 = t1;
    return 0;
}


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
@ 2012-11-09 10:25 ` antoshkka at gmail dot com
  2012-11-09 10:53 ` paolo.carlini at oracle dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: antoshkka at gmail dot com @ 2012-11-09 10:25 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

--- Comment #1 from Antony Polukhin <antoshkka at gmail dot com> 2012-11-09 10:24:49 UTC ---
Created attachment 28648
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28648
Preprocessed file that triggers the bug


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
  2012-11-09 10:25 ` [Bug c++/55249] " antoshkka at gmail dot com
@ 2012-11-09 10:53 ` paolo.carlini at oracle dot com
  2012-11-09 12:21 ` markus at trippelsdorf dot de
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-09 10:53 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-11-09
                 CC|antoshkka at gmail dot com  |
     Ever Confirmed|0                           |1

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-09 10:53:06 UTC ---
We need a self contained reduced testcase for this.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
  2012-11-09 10:25 ` [Bug c++/55249] " antoshkka at gmail dot com
  2012-11-09 10:53 ` paolo.carlini at oracle dot com
@ 2012-11-09 12:21 ` markus at trippelsdorf dot de
  2012-11-09 12:28 ` antoshkka at gmail dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: markus at trippelsdorf dot de @ 2012-11-09 12:21 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus at trippelsdorf dot
                   |                            |de

--- Comment #3 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-11-09 12:21:20 UTC ---
template <typename _Tp> struct A
{
    typedef _Tp value_type;
    value_type _M_instance[1];
};
template <class> struct inner_type
{
    inner_type () {}
    inner_type (inner_type &);
    inner_type (const inner_type &) {}
};

int
main ()
{
    A <inner_type <int>> a, b = a;
}


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
                   ` (2 preceding siblings ...)
  2012-11-09 12:21 ` markus at trippelsdorf dot de
@ 2012-11-09 12:28 ` antoshkka at gmail dot com
  2012-11-09 12:54 ` paolo.carlini at oracle dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: antoshkka at gmail dot com @ 2012-11-09 12:28 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

--- Comment #4 from Antony Polukhin <antoshkka at gmail dot com> 2012-11-09 12:28:11 UTC ---
(In reply to comment #3)

Yes, thanks.
`output.txt` will be the same.

Also, reproduced this bug on GCC 4.7.2:

[cc@ontos-soa-01 ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/cc/dev/gcc-4.7.2/libexec/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../downloads/gcc-4.7.2/configure
--prefix=/home/cc/dev/gcc-4.7.2 --disable-multilib --enable-languages=c,c++
Thread model: posix
gcc version 4.7.2 (GCC)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
                   ` (3 preceding siblings ...)
  2012-11-09 12:28 ` antoshkka at gmail dot com
@ 2012-11-09 12:54 ` paolo.carlini at oracle dot com
  2012-11-09 13:42 ` [Bug c++/55249] [4.6/4.7/4.8 Regression] " paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-09 12:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |jason at gcc dot gnu.org

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-09 12:54:17 UTC ---
Thanks Markus, the issue doesn't seem a regression but seems interesting enough
to add Jason in CC.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] [4.6/4.7/4.8 Regression] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
                   ` (4 preceding siblings ...)
  2012-11-09 12:54 ` paolo.carlini at oracle dot com
@ 2012-11-09 13:42 ` paolo.carlini at oracle dot com
  2012-11-10  3:59 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-09 13:42 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Multiple copy constructors  |[4.6/4.7/4.8 Regression]
                   |for template class lead to  |Multiple copy constructors
                   |link errors                 |for template class lead to
                   |                            |link errors

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-09 13:42:14 UTC ---
Ah! 4.5 was fine.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] [4.6/4.7/4.8 Regression] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
                   ` (5 preceding siblings ...)
  2012-11-09 13:42 ` [Bug c++/55249] [4.6/4.7/4.8 Regression] " paolo.carlini at oracle dot com
@ 2012-11-10  3:59 ` pinskia at gcc dot gnu.org
  2012-12-06 16:12 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-11-10  3:59 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.4.5
   Target Milestone|---                         |4.6.4
      Known to fail|                            |4.7.0

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-11-10 03:59:08 UTC ---
Note with the reduced testcase to compile in C++98 mode, you have to do s/>>/>
>/.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] [4.6/4.7/4.8 Regression] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
                   ` (6 preceding siblings ...)
  2012-11-10  3:59 ` pinskia at gcc dot gnu.org
@ 2012-12-06 16:12 ` rguenth at gcc dot gnu.org
  2012-12-06 20:00 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-06 16:12 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] [4.6/4.7/4.8 Regression] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
                   ` (7 preceding siblings ...)
  2012-12-06 16:12 ` rguenth at gcc dot gnu.org
@ 2012-12-06 20:00 ` jason at gcc dot gnu.org
  2012-12-07  4:54 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-06 20:00 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] [4.6/4.7/4.8 Regression] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
                   ` (8 preceding siblings ...)
  2012-12-06 20:00 ` jason at gcc dot gnu.org
@ 2012-12-07  4:54 ` jason at gcc dot gnu.org
  2012-12-07  4:59 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-07  4:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-07 04:53:55 UTC ---
Author: jason
Date: Fri Dec  7 04:53:46 2012
New Revision: 194281

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194281
Log:
    PR c++/55249
    * tree.c (build_vec_init_elt): Use the type of the initializer.

Added:
    trunk/gcc/testsuite/g++.dg/template/array25.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/tree.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] [4.6/4.7/4.8 Regression] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
                   ` (9 preceding siblings ...)
  2012-12-07  4:54 ` jason at gcc dot gnu.org
@ 2012-12-07  4:59 ` jason at gcc dot gnu.org
  2012-12-07  5:13 ` jason at gcc dot gnu.org
  2012-12-07  5:16 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-07  4:59 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-07 04:58:41 UTC ---
Author: jason
Date: Fri Dec  7 04:58:32 2012
New Revision: 194285

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194285
Log:
    PR c++/55249
    * tree.c (build_vec_init_elt): Use the type of the initializer.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/template/array25.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/tree.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] [4.6/4.7/4.8 Regression] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
                   ` (10 preceding siblings ...)
  2012-12-07  4:59 ` jason at gcc dot gnu.org
@ 2012-12-07  5:13 ` jason at gcc dot gnu.org
  2012-12-07  5:16 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-07  5:13 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-07 05:13:20 UTC ---
Author: jason
Date: Fri Dec  7 05:13:11 2012
New Revision: 194288

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194288
Log:
    PR c++/55249
    * tree.c (build_vec_init_elt): Use the type of the initializer.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/array25.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/tree.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55249] [4.6/4.7/4.8 Regression] Multiple copy constructors for template class lead to link errors
  2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
                   ` (11 preceding siblings ...)
  2012-12-07  5:13 ` jason at gcc dot gnu.org
@ 2012-12-07  5:16 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-07  5:16 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-07 05:15:29 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-12-07  5:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-09 10:24 [Bug c++/55249] New: Multiple copy constructors for template class lead to link errors antoshkka at gmail dot com
2012-11-09 10:25 ` [Bug c++/55249] " antoshkka at gmail dot com
2012-11-09 10:53 ` paolo.carlini at oracle dot com
2012-11-09 12:21 ` markus at trippelsdorf dot de
2012-11-09 12:28 ` antoshkka at gmail dot com
2012-11-09 12:54 ` paolo.carlini at oracle dot com
2012-11-09 13:42 ` [Bug c++/55249] [4.6/4.7/4.8 Regression] " paolo.carlini at oracle dot com
2012-11-10  3:59 ` pinskia at gcc dot gnu.org
2012-12-06 16:12 ` rguenth at gcc dot gnu.org
2012-12-06 20:00 ` jason at gcc dot gnu.org
2012-12-07  4:54 ` jason at gcc dot gnu.org
2012-12-07  4:59 ` jason at gcc dot gnu.org
2012-12-07  5:13 ` jason at gcc dot gnu.org
2012-12-07  5:16 ` jason 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).