From: Gerald Pfeifer <gerald@pfeifer.com>
To: gcc-patches@gcc.gnu.org
Subject: [pushed, C++] wwwdocs: faq: Remove "Copy constructor access check" entry
Date: Sat, 28 Jan 2023 12:14:47 +0100 (CET) [thread overview]
Message-ID: <20230128111449.81D0833E77@hamza.pair.com> (raw)
Sometimes less is more (and our FAQ can use some trimming/updating for
sure).
Pushed.
Gerald
This entry refers to changes in GCC 3.4 and GCC 4.3 which were released
in 2004 and 2008, respectively, and this is hardly a FAQ any more.
---
htdocs/bugs/index.html | 50 ------------------------------------------
1 file changed, 50 deletions(-)
diff --git a/htdocs/bugs/index.html b/htdocs/bugs/index.html
index aaef8915..96a5d0f0 100644
--- a/htdocs/bugs/index.html
+++ b/htdocs/bugs/index.html
@@ -605,56 +605,6 @@ a parse error before the character <code>:</code> (the colon before
<p>The simplest way to avoid this is to write <code>std::vector<
::X></code>, i.e. place a space between the opening angle bracket
and the scope operator.</p></dd>
-
-
-<dt id="cxx_rvalbind">Copy constructor access check while initializing a
-reference.</dt>
-
-<dd><p>Consider this code:</p>
-
-<blockquote><pre>
-class A
-{
-public:
- A();
-
-private:
- A(const A&); // private copy ctor
-};
-
-A makeA(void);
-void foo(const A&);
-
-void bar(void)
-{
- foo(A()); // error, copy ctor is not accessible
- foo(makeA()); // error, copy ctor is not accessible
-
- A a1;
- foo(a1); // OK, a1 is a lvalue
-}</pre></blockquote>
-
-<p>Starting with GCC 3.4.0, binding an rvalue to a const reference requires
-an accessible copy constructor. This might be surprising at first sight,
-especially since most popular compilers do not correctly implement this
-rule.</p>
-
-<p>The C++ Standard says that a temporary object should be created in
-this context and its contents filled with a copy of the object we are
-trying to bind to the reference; it also says that the temporary copy
-can be elided, but the semantic constraints (eg. accessibility) of the
-copy constructor still have to be checked.</p>
-
-<p>For further information, you can consult the following paragraphs of
-the C++ standard: [dcl.init.ref] wwwdocs:/5, bullet 2, sub-bullet 1, and
-[class.temporary] wwwdocs:/2.</p>
-
-<p>Starting with GCC 4.3.0, GCC no longer gives an error for this
-case. This change is based on the
-<a href="https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#391">intent
-of the C++ language committee</a>. As of 2010-05-28, the final
-proposed draft of the C++0x standard permits this code without error.</p>
-</dd>
</dl>
<h3 id="upgrading">Common problems when upgrading the compiler</h3>
--
2.39.1
reply other threads:[~2023-01-28 11:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230128111449.81D0833E77@hamza.pair.com \
--to=gerald@pfeifer.com \
--cc=gcc-patches@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: link
Be 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).