[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] odd/move_semantics 2fbb26c9 1/5: Improve documentati
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] odd/move_semantics 2fbb26c9 1/5: Improve documentation |
Date: |
Mon, 1 Aug 2022 19:37:41 -0400 (EDT) |
branch: odd/move_semantics
commit 2fbb26c9fa3b410f6c398486f0d7cf1cd21fbcff
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Improve documentation
---
sandbox_test.cpp | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/sandbox_test.cpp b/sandbox_test.cpp
index 3bef00be..eea2157a 100644
--- a/sandbox_test.cpp
+++ b/sandbox_test.cpp
@@ -28,19 +28,20 @@
/// Induce ambiguity between a class's copy and move ctors.
///
-/// If class T has both a copy and a move ctor, both of which
-/// can be considered in overload resolution, then this:
+/// If class T has both a copy and a move ctor, both of which can be
+/// considered in overload resolution, then instantiating this:
/// T t {ambiguator<T>{}};
-/// is an error because neither ctor is better than the other.
-/// As clang says:
+/// would be an error because neither ctor is better than the other.
+/// However, detecting that ambiguity in this way:
+/// bool equiplausible = !std::is_constructible_v<T, ambiguator<T>>
+/// is not an error.
+///
+/// The clang-13 diagnostic for attempted instantiation would be:
/// error: call to constructor of 'T' is ambiguous
/// T t {ambiguator<T>{}};
/// ^ ~~~~~~~~~~~~~~~~~
/// note: candidate constructor (the implicit copy constructor)
/// note: candidate constructor (the implicit move constructor)
-/// Detecting that condition in this way:
-/// bool equiplausible = !std::is_constructible_v<T, ambiguator<T>>
-/// is not an error.
template<typename T>
struct ambiguator