public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment
       [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
@ 2013-09-12 19:15 ` paolo.carlini at oracle dot com
  2013-09-12 19:27 ` akrzemi1 at gmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-12 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[C++1] Should warn about    |[C++11] Should warn about
                   |deprecated implicit         |deprecated implicit
                   |generation of copy          |generation of copy
                   |constructor/assignment      |constructor/assignment

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Out of curiosity, are you aware of other compilers emitting such warning? With
which wording, in case? Because I don't seem to be able to get one from current
clang and icc.


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

* [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment
       [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
  2013-09-12 19:15 ` [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment paolo.carlini at oracle dot com
@ 2013-09-12 19:27 ` akrzemi1 at gmail dot com
  2013-09-12 19:37 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: akrzemi1 at gmail dot com @ 2013-09-12 19:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrzej Krzemienski <akrzemi1 at gmail dot com> ---
No. Other compilers (Clang and VS 2010) do not emit such warning either.


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

* [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment
       [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
  2013-09-12 19:15 ` [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment paolo.carlini at oracle dot com
  2013-09-12 19:27 ` akrzemi1 at gmail dot com
@ 2013-09-12 19:37 ` paolo.carlini at oracle dot com
  2013-09-12 19:48 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-12 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I see. Have to double check our policy in this area, I'm not at all sure that
in general anything in Section D gets a warning.


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

* [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment
       [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-09-12 19:37 ` paolo.carlini at oracle dot com
@ 2013-09-12 19:48 ` redi at gcc dot gnu.org
  2013-09-12 19:56 ` daniel.kruegler at googlemail dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2013-09-12 19:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I don't think anything in appendix D apart from auto_ptr does.

The warning would be useful to help find places where defaulted definitions
could be added, but I'm not sure I'd want it enabled by -Wall. YMMV.


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

* [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment
       [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2013-09-12 19:48 ` redi at gcc dot gnu.org
@ 2013-09-12 19:56 ` daniel.kruegler at googlemail dot com
  2013-09-13 10:48 ` akrzemi1 at gmail dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-09-12 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #5 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Jonathan Wakely from comment #4)

-pedantic would seem like a good candidate, no?
>From gcc-bugs-return-429700-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Sep 12 21:06:20 2013
Return-Path: <gcc-bugs-return-429700-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 32543 invoked by alias); 12 Sep 2013 21:06:20 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 32510 invoked by uid 48); 12 Sep 2013 21:06:16 -0000
From: "ppluzhnikov at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58408] New: [C++11] __thread + trivially_constructible -> error
Date: Thu, 12 Sep 2013 21:06:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: ppluzhnikov at google dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-58408-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-09/txt/msg00940.txt.bz2
Content-length: 981

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX408

            Bug ID: 58408
           Summary: [C++11] __thread + trivially_constructible -> error
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref: b/10727382

This source:

class Test {
 public:
 Test() = default;
 Test(char *b) { }
 int i;
};
__thread Test test;


fails to compile with current trunk (g++ (GCC) 4.9.0 20130911 (experimental)):

g++ -c -std=c++11 /tmp/t.c

/tmp/t.cc:8:15: error: non-local variable 'test' declared '__thread' needs
dynamic initialization
 __thread Test test;
               ^
/tmp/t.cc:8:15: note: C++11 'thread_local' allows dynamic initialization and
destruction


I don't see a good reason to reject this source -- the required dynamic
initialization is defaulted.


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

* [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment
       [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2013-09-12 19:56 ` daniel.kruegler at googlemail dot com
@ 2013-09-13 10:48 ` akrzemi1 at gmail dot com
  2014-04-17  8:51 ` akrzemi1 at gmail dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: akrzemi1 at gmail dot com @ 2013-09-13 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrzej Krzemienski <akrzemi1 at gmail dot com> ---
(In reply to Andrzej Krzemienski from comment #2)
> No. Other compilers (Clang and VS 2010) do not emit such warning either.

Correction: The newest version of Clang does give a warning:
"definition of implicit copy constructor for 'W' is deprecated because it has a
user-declared destructor [-Wdeprecated]"


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

* [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment
       [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2013-09-13 10:48 ` akrzemi1 at gmail dot com
@ 2014-04-17  8:51 ` akrzemi1 at gmail dot com
  2014-04-27  0:05 ` alex at suncho dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: akrzemi1 at gmail dot com @ 2014-04-17  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrzej Krzemienski <akrzemi1 at gmail dot com> ---
Just one remark. A warning in this situation is not to just warn about any
deprecated feature, but to indicate something that is very likely to be a bug
(It used to be legal in C++03, so you couldn't legally warn about it; now the
deprecation is just an additional incentive). My guess is that having this copy
constructor implicitly defined when you have a custom destructor is a potential
bug in half of the cases. (Well, "half" is my guess.)


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

* [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment
       [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2014-04-17  8:51 ` akrzemi1 at gmail dot com
@ 2014-04-27  0:05 ` alex at suncho dot com
  2014-04-27 12:13 ` redi at gcc dot gnu.org
  2014-04-27 20:20 ` akrzemi1 at gmail dot com
  9 siblings, 0 replies; 10+ messages in thread
From: alex at suncho dot com @ 2014-04-27  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Howlett <alex at suncho dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alex at suncho dot com

--- Comment #8 from Alex Howlett <alex at suncho dot com> ---
I found this thread because I went Googling after I discovered a bug in my code
resulting from the copy operations being generated despite my having written a
destructor.  I was angry that my compiler (Microsoft) hadn't emitted a warning.

Please add this warning if you haven't already.


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

* [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment
       [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2014-04-27  0:05 ` alex at suncho dot com
@ 2014-04-27 12:13 ` redi at gcc dot gnu.org
  2014-04-27 20:20 ` akrzemi1 at gmail dot com
  9 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-27 12:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-04-27
     Ever confirmed|0                           |1

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andrzej Krzemienski from comment #7)
> (It used to be legal in C++03, so you couldn't legally warn about it;

That's not  true, the compiler can (and does) warn about legal code.

I'm confirming this, we will want the warning at some point, and it would allow
us to improve this part of the -Weffc++ warnings:

* Item 11: Define a copy constructor and an assignment operator for classes
with dynamically allocated memory.

(see PR 16166 for more details)

Maybe we could call this warning -Wdeprecated-special-members, and have it
enabled -Weffc++ and in C++11 also by -Wdeprecated


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

* [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment
       [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2014-04-27 12:13 ` redi at gcc dot gnu.org
@ 2014-04-27 20:20 ` akrzemi1 at gmail dot com
  9 siblings, 0 replies; 10+ messages in thread
From: akrzemi1 at gmail dot com @ 2014-04-27 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Andrzej Krzemienski <akrzemi1 at gmail dot com> ---
I guess, by now "item 11" should read "either delete or define ..."


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

end of thread, other threads:[~2014-04-27 20:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-58407-4@http.gcc.gnu.org/bugzilla/>
2013-09-12 19:15 ` [Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment paolo.carlini at oracle dot com
2013-09-12 19:27 ` akrzemi1 at gmail dot com
2013-09-12 19:37 ` paolo.carlini at oracle dot com
2013-09-12 19:48 ` redi at gcc dot gnu.org
2013-09-12 19:56 ` daniel.kruegler at googlemail dot com
2013-09-13 10:48 ` akrzemi1 at gmail dot com
2014-04-17  8:51 ` akrzemi1 at gmail dot com
2014-04-27  0:05 ` alex at suncho dot com
2014-04-27 12:13 ` redi at gcc dot gnu.org
2014-04-27 20:20 ` akrzemi1 at gmail dot com

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).