From patchwork Tue Oct 3 14:45:57 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Jonathan Wakely
X-Patchwork-Id: 148303
Return-Path:
Delivered-To: ouuuleilei@gmail.com
Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id
hf10csp109226vqb;
Wed, 4 Oct 2023 05:54:43 -0700 (PDT)
X-Google-Smtp-Source:
AGHT+IFoZswTzm6an5JKezz2uxv1W1kkmh4hx2zzD0WA0S0gsGpvurPReLMm2/b/Mf0JfuuMcwRu
X-Received: by 2002:a05:6402:278a:b0:51e:5bd5:fe7e with SMTP id
b10-20020a056402278a00b0051e5bd5fe7emr4896357ede.17.1696424083490;
Wed, 04 Oct 2023 05:54:43 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1696424083; cv=none;
d=google.com; s=arc-20160816;
b=lxM8/s6v1YV/1+wqDI+ig6BjDwUa2CuxVboB8yB68fr/CIxrRgTCGscot69jSNUwc9
LuQwmD12V//TVwp8ze+1F9a/VG8ZFWwad1Zz5OhX1SXAwwZF3Rf0A242vvVsDgOgL00G
TxODYTon+7e6GfPxIrrZ58zZxvJJemVby9JX6k5IXTa/a8uQN2ZWT5aI9UlTymZkuyZQ
WXSWG8msi8vSuJoTeWmmOQioiAMxRjZMAf4KILyhoVUl0FK/524PrnJUTBf9+Ti1zQ80
JOqbafSNJ+1vx3+daPT+isPSAIlW/VTipDq/JwsIN/CDGdegIGA5WQdAgp4nI1Bh9TPm
g9YA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:list-subscribe:list-help:list-post:list-archive
:list-unsubscribe:list-id:precedence:content-transfer-encoding
:mime-version:message-id:date:subject:cc:to:from:dkim-signature
:dmarc-filter:delivered-to;
bh=TcSVYQxN0BnqJGtR7Lmqhb5osSg38gC6aFFKEAXPEQM=;
fh=Px0ai+PRlAML1LDC3BukPvCf8nEgqik/SD+oF2SuaP0=;
b=HCYfAW3bbcbjdnMBg5qfZWgysuCS2uj/KiIgDe6bAR9EXU0lygpG46JtHdfl25PeeQ
ZnrV2PvUGp+6q8D/dKZFX/3Bk5DLNqkA7GiMT+p5e5LIalrAjZ2W7YA9HWXYoi/RIQTB
y3Rq8QuqmUdtMD4SC6XwAeykUx5lVATlpK7wYw+MkovYSsEbbvXKAkZvLC3GWfvJ+BEU
FjbDM/GcUtJgDHmCRUdZwERCfGidka+oYUkJES8OcNEoZNu93woM5Blgk5o/6Lj/hx/9
bcaQtnqcgxuqM0OFjx6n+Nn5jhwOKaxtig4HdeM7F4in1ux4xgLDixvYUmry1W+RR0eD
g5ow==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@redhat.com header.s=mimecast20190719
header.b=FYP7cRhO;
spf=pass (google.com: domain of
gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as
permitted sender)
smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org";
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org.
[8.43.85.97])
by mx.google.com with ESMTPS id
s2-20020aa7d782000000b005236a77eb1dsi1583427edq.104.2023.10.04.05.54.43
for
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 04 Oct 2023 05:54:43 -0700 (PDT)
Received-SPF: pass (google.com: domain of
gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as
permitted sender) client-ip=8.43.85.97;
Authentication-Results: mx.google.com;
dkim=pass header.i=@redhat.com header.s=mimecast20190719
header.b=FYP7cRhO;
spf=pass (google.com: domain of
gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as
permitted sender)
smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org";
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from server2.sourceware.org (localhost [IPv6:::1])
by sourceware.org (Postfix) with ESMTP id 8DF4A3882670
for ; Wed, 4 Oct 2023 12:47:46 +0000 (GMT)
X-Original-To: gcc-patches@gcc.gnu.org
Delivered-To: gcc-patches@gcc.gnu.org
Received: from us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.129.124])
by sourceware.org (Postfix) with ESMTPS id 602BF385700B
for ; Wed, 4 Oct 2023 12:47:23 +0000 (GMT)
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 602BF385700B
Authentication-Results: sourceware.org;
dmarc=pass (p=none dis=none) header.from=redhat.com
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1696423642;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=TcSVYQxN0BnqJGtR7Lmqhb5osSg38gC6aFFKEAXPEQM=;
b=FYP7cRhO5/WVeBTjQ0HhcL4iLRuwplUcpV4dx//al/iPBrvkaCp84WtorKhE2ZCWAL6ioK
NF7Y6v7daS9Dhcxbm102vA1n2c7Kn2C/l5U/ZyHY8YKvSVjg4ZuK0EzXT394nCLHOhxysb
iHErXM7QPNpP6mBRqrcA0Y/gfGu6JMU=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-49-WP5bKwQuMkyzcSexCEC_WQ-1; Wed, 04 Oct 2023 08:47:20 -0400
X-MC-Unique: WP5bKwQuMkyzcSexCEC_WQ-1
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com
[10.11.54.3])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2902C18162D3
for ; Wed, 4 Oct 2023 12:47:20 +0000 (UTC)
Received: from localhost (unknown [10.42.28.167])
by smtp.corp.redhat.com (Postfix) with ESMTP id DB41E1004042;
Wed, 4 Oct 2023 12:47:19 +0000 (UTC)
From: Jonathan Wakely
To: gcc-patches@gcc.gnu.org
Cc: Jason Merrill
Subject: [PATCH] wwwdocs: Add ADL to C++ non-bugs
Date: Tue, 3 Oct 2023 15:45:57 +0100
Message-ID: <20231004124718.3237337-1-jwakely@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,
DATE_IN_PAST_12_24,
DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF,
GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,
SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: gcc-patches@gcc.gnu.org
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: Gcc-patches mailing list
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org
X-getmail-retrieved-from-mailbox: INBOX
X-GMAIL-THRID: 1778829580114538619
X-GMAIL-MSGID: 1778829580114538619
We have a long history of INVALID bugs about std functions being
available in the global namespace (PRs 27846, 67566, 82619, 99865,
110602, 111553, probably others). Let's document it.
Also de-prioritize the C++98-only bugs, which are unlikely to affect
anybody nowadays.
OK for wwwdocs?
-- >8 --
Add ADL to C++ non-bugs
Also move the item about C++98 'export' to the end, and update the item
about <: digraphs that only applies to C++98.
---
htdocs/bugs/index.html | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/htdocs/bugs/index.html b/htdocs/bugs/index.html
index 813b78c0..41edc561 100644
--- a/htdocs/bugs/index.html
+++ b/htdocs/bugs/index.html
@@ -539,15 +539,15 @@ for details.
C++
-export
-Most C++ compilers (G++ included) never implemented C++98
-export
, which was removed in C++11, and the keyword reused in
-C++20 by the Modules feature. The C++98 feature was intended to support
-separate compilation of template declarations and
-definitions. Without export
, a template definition must be in
-scope to be used. The obvious workaround is simply to place all definitions in
-the header itself. Alternatively, the compilation unit containing template
-definitions may be included from the header.
+- Functions can be called without qualifying them with their namespace.
+-
+Argument Dependent Lookup (ADL) means that functions can be found in namespaces
+associated with their arguments. This means that
move(arg)
can
+call std::move
if arg
is a type defined in namespace
+std
, such as std::string
or std::vector
.
+If std::move
is not the function you intended to call, use a
+qualified name such as ::move(arg)
or foo::move(arg)
.
+
- Nested classes can access private members and types of the containing
class.
@@ -597,9 +597,9 @@ handler and catch it in the main thread.
If you have a class in the global namespace, say named X
,
and want to give it as a template argument to some other class, say
std::vector
, then std::vector<::X>
-fails with a parser error.
+fails with a parser error in C++98/C++03 mode.
-The reason is that the standard mandates that the sequence
+
The reason is that the C++98 standard mandates that the sequence
<:
is treated as if it were the token [
.
(There are several such combinations of characters - they are called
digraphs.) Depending on the version, the compiler then reports
@@ -608,7 +608,19 @@ a parse error before the character :
(the colon before
The simplest way to avoid this is to write std::vector<
::X>
, i.e. place a space between the opening angle bracket
-and the scope operator.
+and the scope operator, or compile using C++11 or later. Defect report 1104
+changed the parser rules so that <::
works as expected.
+
+
+export
+Most C++ compilers (G++ included) never implemented C++98
+export
, which was removed in C++11, and the keyword reused in
+C++20 by the Modules feature. The C++98 feature was intended to support
+separate compilation of template declarations and
+definitions. Without export
, a template definition must be in
+scope to be used. The obvious workaround is simply to place all definitions in
+the header itself. Alternatively, the compilation unit containing template
+definitions may be included from the header.
Common problems when upgrading the compiler