From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 14E3C385802F; Thu, 5 Oct 2023 09:08:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14E3C385802F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1696496905; bh=LOR26eXg0RZJSflohNlUOiDh1ioRLA/3AfqNTuT384Y=; h=To:Subject:Date:From:From; b=o7VU5rW2+S7u+qaxUHnVbkBmlzYr5n3dxH2wy0VAjBNcBK1PwKxIJgskZvMJz7r3I MPK3PM0sHNuiJwd2L5m0qNLLCKuCSsLBY4IBH1gEok1GkPDQHznviz5Od0HKuMk1TM RWiHxN2tdi1dF4oTwIAEZGjYlAMZJYxbKUstoGnk= To: gcc-cvs-wwwdocs@gcc.gnu.org Subject: gcc-wwwdocs branch master updated. 6ffdf53463831ec99b718151314e225c747a32d1 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 50c5c9f94be7b26a2853f64909fa61ebf60086aa X-Git-Newrev: 6ffdf53463831ec99b718151314e225c747a32d1 Message-Id: <20231005090825.14E3C385802F@sourceware.org> Date: Thu, 5 Oct 2023 09:08:25 +0000 (GMT) From: Jonathan Wakely List-Id: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gcc-wwwdocs". The branch, master has been updated via 6ffdf53463831ec99b718151314e225c747a32d1 (commit) from 50c5c9f94be7b26a2853f64909fa61ebf60086aa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6ffdf53463831ec99b718151314e225c747a32d1 Author: Jonathan Wakely Date: Tue Oct 3 14:57:34 2023 +0100 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. 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

----------------------------------------------------------------------- Summary of changes: htdocs/bugs/index.html | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) hooks/post-receive -- gcc-wwwdocs