Skip to content

Commit

Permalink
Clarify preference for definitions in 'source_location_of'. (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
katzdm authored Oct 29, 2024
1 parent 824705a commit 95440a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
32 changes: 15 additions & 17 deletions 2996_reflection/p2996r8.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="generator" content="mpark/wg21" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<meta name="dcterms.date" content="2024-10-28" />
<meta name="dcterms.date" content="2024-10-29" />
<title>Reflection for C++26</title>
<style>
code{white-space: pre-wrap;}
Expand Down Expand Up @@ -565,7 +565,7 @@ <h1 class="title" style="text-align:center">Reflection for C++26</h1>
</tr>
<tr>
<td>Date:</td>
<td>2024-10-28</td>
<td>2024-10-29</td>
</tr>
<tr>
<td style="vertical-align:top">Project:</td>
Expand Down Expand Up @@ -779,9 +779,9 @@ <h1 id="toctitle">Contents</h1>
expressions<span></span></a></li>
<li><a href="#expr.prim.id.splice-splice-specifiers" id="toc-expr.prim.id.splice-splice-specifiers">7.5.4.0*
[expr.prim.id.splice] Splice specifiers<span></span></a></li>
<li><a href="#expr.prim.id.general-general" id="toc-expr.prim.id.general-general"><span>7.5.5.1
<li><a href="#expr.prim.id.general-general" id="toc-expr.prim.id.general-general"><span>7.5.4.1
<span>[expr.prim.id.general]</span></span> General<span></span></a></li>
<li><a href="#expr.prim.id.qual-qualified-names" id="toc-expr.prim.id.qual-qualified-names"><span>7.5.5.3
<li><a href="#expr.prim.id.qual-qualified-names" id="toc-expr.prim.id.qual-qualified-names"><span>7.5.4.3
<span>[expr.prim.id.qual]</span></span> Qualified
names<span></span></a></li>
<li><a href="#expr.prim.splice-expression-splicing" id="toc-expr.prim.splice-expression-splicing">7.5.8* [expr.prim.splice]
Expand Down Expand Up @@ -1005,7 +1005,7 @@ <h1 data-number="1" style="border-bottom:1px solid #cccccc" id="revision-history
<code class="sourceCode cpp">has_complete_definition</code>.</li>
<li>removed <code class="sourceCode cpp">subobjects_of</code> and
<code class="sourceCode cpp">accessible_subobjects_of</code> (will be
reintroduced by <span class="citation" data-cites="P3293R1">[<a href="https://wg21.link/p3293r1" role="doc-biblioref">P3293R1</a>]</span>).</li>
reintroduced by <span class="citation" data-cites="P3293R1">[<a href="#ref-P3293R1" role="doc-biblioref"><strong>P3293R1?</strong></a>]</span>).</li>
<li>specified constraints for
<code class="sourceCode cpp">enumerators_of</code> in terms of
<code class="sourceCode cpp">has_complete_definition</code>.</li>
Expand Down Expand Up @@ -1924,7 +1924,7 @@ <h2 data-number="3.9" id="a-simple-variant-type"><span class="header-section-num
</blockquote>
</div>
<p>Arguably, the answer should be yes - this would be consistent with
how other accesses work. This is instead proposed in <span class="citation" data-cites="P3293R1">[<a href="https://wg21.link/p3293r1" role="doc-biblioref">P3293R1</a>]</span>.</p>
how other accesses work. This is instead proposed in <span class="citation" data-cites="P3293R1">[<a href="#ref-P3293R1" role="doc-biblioref"><strong>P3293R1?</strong></a>]</span>.</p>
<p>On Compiler Explorer: <a href="https://godbolt.org/z/Efz5vsjaa">EDG</a>, <a href="https://godbolt.org/z/3bvo97fqf">Clang</a>.</p>
<h2 data-number="3.10" id="struct-to-struct-of-arrays"><span class="header-section-number">3.10</span> Struct to Struct of Arrays<a href="#struct-to-struct-of-arrays" class="self-link"></a></h2>
<div class="std">
Expand Down Expand Up @@ -5399,10 +5399,10 @@ <h3 class="unnumbered" id="expr.prim.id.splice-splice-specifiers">7.5.4.0*
</div>
</blockquote>
</div>
<h3 class="unnumbered" id="expr.prim.id.general-general"><span>7.5.5.1
<h3 class="unnumbered" id="expr.prim.id.general-general"><span>7.5.4.1
<a href="https://wg21.link/expr.prim.id.general">[expr.prim.id.general]</a></span>
General<a href="#expr.prim.id.general-general" class="self-link"></a></h3>
<p>Add a carve-out for reflection in <span>7.5.5.1 <a href="https://wg21.link/expr.prim.id.general">[expr.prim.id.general]</a></span>/4:</p>
<p>Add a carve-out for reflection in <span>7.5.4.1 <a href="https://wg21.link/expr.prim.id.general">[expr.prim.id.general]</a></span>/4:</p>
<div class="std">
<blockquote>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_37" id="pnum_37">4</a></span>
Expand Down Expand Up @@ -5430,7 +5430,7 @@ <h3 class="unnumbered" id="expr.prim.id.general-general"><span>7.5.5.1
</ul>
</blockquote>
</div>
<h3 class="unnumbered" id="expr.prim.id.qual-qualified-names"><span>7.5.5.3 <a href="https://wg21.link/expr.prim.id.qual">[expr.prim.id.qual]</a></span>
<h3 class="unnumbered" id="expr.prim.id.qual-qualified-names"><span>7.5.4.3 <a href="https://wg21.link/expr.prim.id.qual">[expr.prim.id.qual]</a></span>
Qualified names<a href="#expr.prim.id.qual-qualified-names" class="self-link"></a></h3>
<p>Add a production to the grammar for
<code class="sourceCode cpp"><em>nested-name-specifier</em></code> as
Expand Down Expand Up @@ -5527,7 +5527,7 @@ <h3 class="unnumbered" id="expr.prim.id.qual-qualified-names"><span>7.5.5.3 <a h
<h3 class="unnumbered" id="expr.prim.splice-expression-splicing">7.5.8*
[expr.prim.splice] Expression splicing<a href="#expr.prim.splice-expression-splicing" class="self-link"></a></h3>
<p>Add a new subsection of <span>7.5 <a href="https://wg21.link/expr.prim">[expr.prim]</a></span> following
<span>7.5.8 <a href="https://wg21.link/expr.prim.req">[expr.prim.req]</a></span></p>
<span>7.5.7 <a href="https://wg21.link/expr.prim.req">[expr.prim.req]</a></span></p>
<div class="std">
<blockquote>
<div class="addu">
Expand Down Expand Up @@ -6065,7 +6065,7 @@ <h3 class="unnumbered" id="expr.const-constant-expressions"><span>7.7 <a href="h
(<span>13.3 <a href="https://wg21.link/temp.names">[temp.names]</a></span>), or</li>
<li>in a
<code class="sourceCode cpp"><em>requires-expression</em></code>
(<span>7.5.8 <a href="https://wg21.link/expr.prim.req">[expr.prim.req]</a></span>),
(<span>7.5.7 <a href="https://wg21.link/expr.prim.req">[expr.prim.req]</a></span>),
or</li>
</ul></li>
<li><span class="marginalizedparent"><a class="marginalized" href="#pnum_100" id="pnum_100">(20.4.2)</a></span>
Expand Down Expand Up @@ -7958,8 +7958,10 @@ <h3 class="unnumbered" id="meta.reflection.names-reflection-names-and-locations"
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_205" id="pnum_205">8</a></span>
<em>Recommended practice</em>: If <code class="sourceCode cpp">r</code>
represents an entity, name, or base specifier that was introduced by a
declaration, implementations should return a value corresponding to the
declaration.</p>
declaration, implementations should return a value corresponding to a
declaration of the represented construct. If multiple such declarations
exist and one is a definition, a value corresponding to the definition
is preferred.</p>
</div>
</blockquote>
</div>
Expand Down Expand Up @@ -10009,10 +10011,6 @@ <h1 data-number="6" style="border-bottom:1px solid #cccccc" id="bibliography"><s
[P3096R1] Adam Lach, Walter Genovese. 2024-05-15. Function Parameter
Reflection in Reflection for C++26. <a href="https://wg21.link/p3096r1"><div class="csl-block">https://wg21.link/p3096r1</div></a>
</div>
<div id="ref-P3293R1" class="csl-entry" role="doc-biblioentry">
[P3293R1] Barry Revzin, Peter Dimov, Dan Katz, Daveed Vandevoorde.
2024-10-13. Splicing a base class subobject. <a href="https://wg21.link/p3293r1"><div class="csl-block">https://wg21.link/p3293r1</div></a>
</div>
<div id="ref-P3295R0" class="csl-entry" role="doc-biblioentry">
[P3295R0] Ben Craig. 2024-05-21. Freestanding constexpr containers and
constexpr exception types. <a href="https://wg21.link/p3295r0"><div class="csl-block">https://wg21.link/p3295r0</div></a>
Expand Down
2 changes: 1 addition & 1 deletion 2996_reflection/reflection.md
Original file line number Diff line number Diff line change
Expand Up @@ -4868,7 +4868,7 @@ consteval source_location source_location_of(info r);

[#]{.pnum} *Returns*: If `r` represents a value, a non-class type, the global namespace, or a description of a declaration of a non-static data member, then `source_location{}`. Otherwise, an implementation-defined `source_location` value.

[#]{.pnum} *Recommended practice*: If `r` represents an entity, name, or base specifier that was introduced by a declaration, implementations should return a value corresponding to the declaration.
[#]{.pnum} *Recommended practice*: If `r` represents an entity, name, or base specifier that was introduced by a declaration, implementations should return a value corresponding to a declaration of the represented construct. If multiple such declarations exist and one is a definition, a value corresponding to the definition is preferred.
:::
:::

Expand Down

0 comments on commit 95440a7

Please sign in to comment.