public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/58074] New: [C++11] __is_trivial intrinsic fails for deleted members and for non-trivial copy-c'tors Date: Sat, 03 Aug 2013 17:58:00 -0000 [thread overview] Message-ID: <bug-58074-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58074 Bug ID: 58074 Summary: [C++11] __is_trivial intrinsic fails for deleted members and for non-trivial copy-c'tors Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: daniel.kruegler at googlemail dot com The following observations where originally found by testing the std::is_trivial trait from <type_traits>, but the actual problem seems to result from the __is_trivial intrinsic, therefore I created a non-library issue from this. gcc 4.9.0 20130616 (experimental) when compiled with the flags -std=c++11 -Wall -pedantic rejects the following code: //----------------------------- struct Trivial { Trivial() = delete; }; struct NonTrivial { NonTrivial() = default; NonTrivial(NonTrivial&) = default; NonTrivial& operator=(NonTrivial&) = default; }; static_assert(__is_trivial(Trivial), "Ouch"); static_assert(!__is_trivial(NonTrivial), "Ouch"); //----------------------------- " main.cpp|13|error: static assertion failed: Ouch| main.cpp|14|error: static assertion failed: Ouch| " The first test should be valid, because 12.1 p4 says "A default constructor is trivial if it is **not user-provided** and if [..]" and according to 8.4.2 p4 "A function is user-provided if it is user-declared and **not explicitly defaulted or deleted** on its first declaration.". The deleted default constructor should not prevent type Trivial of being trivial (Maybe this part of the problem is related to bug 52707, but I'm not sure). The second test should succeed, because according to 12.8 p12: "A copy/move constructor for class X is trivial if it is not user-provided, **its declared parameter type is the same as if it had been implicitly declared**, and if [..]" and 12.8 p25, respectively: "A copy/move assignment operator for class X is trivial if it is not user-provided, **its declared parameter type is the same as if it had been implicitly declared**, and if [..]" The copy-constructor/assignment operator of NonTrivial do both not have the parameter type (according to the definition of function parameter types as of 8.3.5) as if it had been implicitly declared.
next reply other threads:[~2013-08-03 17:58 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-08-03 17:58 daniel.kruegler at googlemail dot com [this message] 2013-08-03 18:12 ` [Bug c++/58074] " paolo.carlini at oracle dot com 2013-12-09 9:34 ` paolo.carlini at oracle dot com 2015-06-09 20:51 ` richard-gccbugzilla at metafoo dot co.uk 2015-07-09 9:12 ` paolo.carlini at oracle dot com 2015-09-22 15:21 ` [Bug c++/58074] [C++11][DR 1333] " jason at gcc dot gnu.org 2015-09-22 15:22 ` jason at gcc dot gnu.org 2024-06-18 20:22 ` mpolacek at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-58074-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).