Skip to content

Commit

Permalink
SFINAE substitutions reset NestedNameSpecifier
Browse files Browse the repository at this point in the history
#fix

fix #774
  • Loading branch information
alandefreitas committed Jan 14, 2025
1 parent 80a9509 commit e4a2a00
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/lib/AST/TerminalTypeVisitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TerminalTypeVisitor
bool IsPack_ = false;

// The optional NestedNameSpecifier.
const NestedNameSpecifier* NNS_;
const NestedNameSpecifier* NNS_ = nullptr;

public:
/** Constructor for TerminalTypeVisitor.
Expand Down Expand Up @@ -570,7 +570,8 @@ class TerminalTypeVisitor
{
if (auto SFINAE = getASTVisitor().extractSFINAEInfo(T))
{
return getDerived().Visit(SFINAE->first);
NNS_ = nullptr;
return getDerived().Visit(SFINAE->Type);
}

if (auto const* NNS = T->getQualifier())
Expand Down Expand Up @@ -604,7 +605,8 @@ class TerminalTypeVisitor
MRDOCS_SYMBOL_TRACE(T, Visitor_.context_);
if (auto SFINAE = getASTVisitor().extractSFINAEInfo(T))
{
return getDerived().Visit(SFINAE->first);
NNS_ = nullptr;
return getDerived().Visit(SFINAE->Type);
}

// In most cases, a template name is simply a reference
Expand Down
2 changes: 1 addition & 1 deletion test-files/golden-tests/core/libcxx.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Declared in `<libcxx.cpp>`
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template<typename T>
<<std,std>>::T
T
sqrt(T value);
----

Expand Down
2 changes: 1 addition & 1 deletion test-files/golden-tests/core/libcxx.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h3>Synopsis</h3>
<pre>
<code class="source-code cpp">
template&lt;typename T&gt;
<a href="#std">std</a>::T
T
sqrt(T value);
</code>
</pre>
Expand Down
2 changes: 1 addition & 1 deletion test-files/golden-tests/core/libcxx.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<function name="sqrt" id="ulFDUE1svTCX8fV/h8EIp4NNbWs=">
<file path="libcxx.cpp" line="149"/>
<return>
<type name="std::T"/>
<type name="T"/>
</return>
<param name="value">
<type name="T"/>
Expand Down
2 changes: 1 addition & 1 deletion test-files/golden-tests/snippets/sqrt.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Declared in `&lt;sqrt&period;cpp&gt;`
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename T&gt;
<<std,std>>::T
T
sqrt(T value);
----

Expand Down
2 changes: 1 addition & 1 deletion test-files/golden-tests/snippets/sqrt.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h3>Synopsis</h3>
<pre>
<code class="source-code cpp">
template&lt;typename T&gt;
<a href="#std">std</a>::T
T
sqrt(T value);
</code>
</pre>
Expand Down
2 changes: 1 addition & 1 deletion test-files/golden-tests/snippets/sqrt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<function name="sqrt" id="ulFDUE1svTCX8fV/h8EIp4NNbWs=">
<file path="sqrt.cpp" line="15" class="def"/>
<return>
<type name="std::T"/>
<type name="T"/>
</return>
<param name="value">
<type name="T"/>
Expand Down

0 comments on commit e4a2a00

Please sign in to comment.