public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type
@ 2011-06-03  2:39 merkert at comcast dot net
  2011-06-03  2:41 ` [Bug libstdc++/49274] " merkert at comcast dot net
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: merkert at comcast dot net @ 2011-06-03  2:39 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Regression: unique_ptr needs full definition of map
                    type
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: merkert@comcast.net


Created attachment 24420
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24420
Error message for gcc -std=c++0x -c foo.cpp

This code no longer compiles with gcc-4.7-20110528:

#include <memory>
#include <map>

using namespace std;

struct Foo {
  Foo(const Foo&) = delete;
  Foo&operator=(const Foo&) = delete;

  struct CMP;

  ~Foo();

  unique_ptr<map< int, int,CMP> > cmp;
};

The compilation is:
gcc -std=c++0x -c foo.cpp 


ray@jupiter:~/tmp> gcc --version
gcc (GCC) 4.7.0 20110528 (experimental)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


I've attached the error message.


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

* [Bug libstdc++/49274] Regression: unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
@ 2011-06-03  2:41 ` merkert at comcast dot net
  2011-06-03  8:34 ` redi at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: merkert at comcast dot net @ 2011-06-03  2:41 UTC (permalink / raw)
  To: gcc-bugs

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

merkert at comcast dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |libstdc++

--- Comment #1 from merkert at comcast dot net 2011-06-03 02:41:32 UTC ---
I think it's a libstdc++ issue, so I changed the component. I should say this
works with 4.6


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

* [Bug libstdc++/49274] Regression: unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
  2011-06-03  2:41 ` [Bug libstdc++/49274] " merkert at comcast dot net
@ 2011-06-03  8:34 ` redi at gcc dot gnu.org
  2011-06-03  8:50 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2011-06-03  8:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo.carlini at oracle dot
                   |                            |com
           Severity|major                       |normal

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-03 08:33:42 UTC ---
the problem is that std::map requires the CMP class to be defined

it's undefined behaviour to instantiate std::map with an incomplete type,
apparently what's changed is that unique_ptr instantiates it.

Paolo, any idea if is this caused by a noexcept change somewhere?


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

* [Bug libstdc++/49274] Regression: unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
  2011-06-03  2:41 ` [Bug libstdc++/49274] " merkert at comcast dot net
  2011-06-03  8:34 ` redi at gcc dot gnu.org
@ 2011-06-03  8:50 ` redi at gcc dot gnu.org
  2011-06-03  9:32 ` paolo.carlini at oracle dot com
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2011-06-03  8:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-03 08:50:23 UTC ---
I'm not sure why default_delete<T> needs to instantiate T, it doesn't need a
complete type except in operator()


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

* [Bug libstdc++/49274] Regression: unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (2 preceding siblings ...)
  2011-06-03  8:50 ` redi at gcc dot gnu.org
@ 2011-06-03  9:32 ` paolo.carlini at oracle dot com
  2011-06-03  9:37 ` paolo.carlini at oracle dot com
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-06-03  9:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-06-03 09:32:34 UTC ---
Jon, I'm traveling, I cannot investigate this in detail, but I'm wondering if
this isn't a duplicate of the recent issue failed by Marc Glisse, about pair,
noexcept and incompleteness, which turned out to be definitely a c++ front-end
issue. I also markes it as regression. Can you check it?


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

* [Bug libstdc++/49274] Regression: unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (3 preceding siblings ...)
  2011-06-03  9:32 ` paolo.carlini at oracle dot com
@ 2011-06-03  9:37 ` paolo.carlini at oracle dot com
  2011-06-03 10:19 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-06-03  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-06-03 09:37:00 UTC ---
PR49107


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

* [Bug libstdc++/49274] Regression: unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (4 preceding siblings ...)
  2011-06-03  9:37 ` paolo.carlini at oracle dot com
@ 2011-06-03 10:19 ` redi at gcc dot gnu.org
  2011-06-03 11:20 ` [Bug c++/49274] [4.6/4.7 Regression] " redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2011-06-03 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.06.03 10:18:52
     Ever Confirmed|0                           |1

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-03 10:18:52 UTC ---
Thanks for the pointer, Paolo, I'll take a look later today.

Confirming anyway, as unique_ptr<T> should work with incomplete T


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

* [Bug c++/49274] [4.6/4.7 Regression] unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (5 preceding siblings ...)
  2011-06-03 10:19 ` redi at gcc dot gnu.org
@ 2011-06-03 11:20 ` redi at gcc dot gnu.org
  2011-06-03 11:40 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2011-06-03 11:20 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
          Component|libstdc++                   |c++
      Known to work|                            |4.4.5, 4.5.0
            Summary|Regression: unique_ptr      |[4.6/4.7 Regression]
                   |needs full definition of    |unique_ptr needs full
                   |map type                    |definition of map type

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-03 11:19:59 UTC ---
reduced, with no library or c++0x dependencies:

struct incomplete;

template<typename T>
struct cont
{
  T t;
};

template<typename> struct complete { };


int main()
{
  complete<cont<incomplete>> c;
  c = c;
}

which works prior to 4.6, and with EDG and clang

with 4.6 and later the assignment requires cont<incomplete> to be complete,
even though it is unused in complete.

In the original testcase that causes is_assignable to instantiate
map<int,int,CMP>

Jason, could you take a look?
Possibly the same issue as PR 49107


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

* [Bug c++/49274] [4.6/4.7 Regression] unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (6 preceding siblings ...)
  2011-06-03 11:20 ` [Bug c++/49274] [4.6/4.7 Regression] " redi at gcc dot gnu.org
@ 2011-06-03 11:40 ` paolo.carlini at oracle dot com
  2011-06-03 12:03 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-06-03 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-06-03 11:40:20 UTC ---
Thanks Jon.


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

* [Bug c++/49274] [4.6/4.7 Regression] unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (7 preceding siblings ...)
  2011-06-03 11:40 ` paolo.carlini at oracle dot com
@ 2011-06-03 12:03 ` redi at gcc dot gnu.org
  2011-06-03 12:37 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2011-06-03 12:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|4.5.0                       |4.1.2
      Known to fail|                            |4.5.2, 4.6.0, 4.7.0

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-03 12:02:55 UTC ---
actually it fails with 4.5 too, I tried with an old pre-4.5.0 snapshot at
first, but 4.5.0 and later reject it


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

* [Bug c++/49274] [4.6/4.7 Regression] unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (8 preceding siblings ...)
  2011-06-03 12:03 ` redi at gcc dot gnu.org
@ 2011-06-03 12:37 ` jakub at gcc dot gnu.org
  2011-06-03 14:05 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-03 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-03 12:37:10 UTC ---
Started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153958


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

* [Bug c++/49274] [4.6/4.7 Regression] unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (9 preceding siblings ...)
  2011-06-03 12:37 ` jakub at gcc dot gnu.org
@ 2011-06-03 14:05 ` jason at gcc dot gnu.org
  2011-06-03 14:09 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-03 14:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-03 14:03:59 UTC ---
Yes, cont<incomplete> is an associated type for argument-dependent lookup, so
we instantiate it to get any friend declarations.  I think G++ is correct.

Clang fails to compile the testcase for 34870.  Interestingly, EDG accepts both
this testcase and the testcase for 34870.  I wonder why that would be.


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

* [Bug c++/49274] [4.6/4.7 Regression] unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (10 preceding siblings ...)
  2011-06-03 14:05 ` jason at gcc dot gnu.org
@ 2011-06-03 14:09 ` jason at gcc dot gnu.org
  2011-06-03 14:15 ` paolo.carlini at oracle dot com
  2011-06-03 14:37 ` redi at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-03 14:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #12 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-03 14:08:32 UTC ---
http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#557


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

* [Bug c++/49274] [4.6/4.7 Regression] unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (11 preceding siblings ...)
  2011-06-03 14:09 ` jason at gcc dot gnu.org
@ 2011-06-03 14:15 ` paolo.carlini at oracle dot com
  2011-06-03 14:37 ` redi at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-06-03 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-06-03 14:14:14 UTC ---
Ah, thus exactly like the issue we discussed a few days ago. I suspected that
and indeed Intel was accepting the code.

By the way, PR49107 is different then?


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

* [Bug c++/49274] [4.6/4.7 Regression] unique_ptr needs full definition of map type
  2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
                   ` (12 preceding siblings ...)
  2011-06-03 14:15 ` paolo.carlini at oracle dot com
@ 2011-06-03 14:37 ` redi at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2011-06-03 14:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-03 14:37:17 UTC ---
Thanks, Jason.

So to respond to the OP, although unique_ptr<T> allows T to be incomplete it
might instantiate T, and unlike unique_ptr most templates in the standard
library cannot be instantiated with incomplete types, so if T is e.g.
std::map<int, incomplete> then the results are undefined.


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

end of thread, other threads:[~2011-06-03 14:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-03  2:39 [Bug c++/49274] New: Regression: unique_ptr needs full definition of map type merkert at comcast dot net
2011-06-03  2:41 ` [Bug libstdc++/49274] " merkert at comcast dot net
2011-06-03  8:34 ` redi at gcc dot gnu.org
2011-06-03  8:50 ` redi at gcc dot gnu.org
2011-06-03  9:32 ` paolo.carlini at oracle dot com
2011-06-03  9:37 ` paolo.carlini at oracle dot com
2011-06-03 10:19 ` redi at gcc dot gnu.org
2011-06-03 11:20 ` [Bug c++/49274] [4.6/4.7 Regression] " redi at gcc dot gnu.org
2011-06-03 11:40 ` paolo.carlini at oracle dot com
2011-06-03 12:03 ` redi at gcc dot gnu.org
2011-06-03 12:37 ` jakub at gcc dot gnu.org
2011-06-03 14:05 ` jason at gcc dot gnu.org
2011-06-03 14:09 ` jason at gcc dot gnu.org
2011-06-03 14:15 ` paolo.carlini at oracle dot com
2011-06-03 14:37 ` redi 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).