From e4a2a00f479e93b51f22ab8b83723627610e8082 Mon Sep 17 00:00:00 2001 From: alandefreitas Date: Tue, 14 Jan 2025 16:52:42 -0300 Subject: [PATCH] SFINAE substitutions reset NestedNameSpecifier #fix fix #774 --- src/lib/AST/TerminalTypeVisitor.hpp | 8 +++++--- test-files/golden-tests/core/libcxx.adoc | 2 +- test-files/golden-tests/core/libcxx.html | 2 +- test-files/golden-tests/core/libcxx.xml | 2 +- test-files/golden-tests/snippets/sqrt.adoc | 2 +- test-files/golden-tests/snippets/sqrt.html | 2 +- test-files/golden-tests/snippets/sqrt.xml | 2 +- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/lib/AST/TerminalTypeVisitor.hpp b/src/lib/AST/TerminalTypeVisitor.hpp index c3b7b5fe1..d131ef05d 100644 --- a/src/lib/AST/TerminalTypeVisitor.hpp +++ b/src/lib/AST/TerminalTypeVisitor.hpp @@ -85,7 +85,7 @@ class TerminalTypeVisitor bool IsPack_ = false; // The optional NestedNameSpecifier. - const NestedNameSpecifier* NNS_; + const NestedNameSpecifier* NNS_ = nullptr; public: /** Constructor for TerminalTypeVisitor. @@ -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()) @@ -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 diff --git a/test-files/golden-tests/core/libcxx.adoc b/test-files/golden-tests/core/libcxx.adoc index 15b1d7417..29e6e9d4d 100644 --- a/test-files/golden-tests/core/libcxx.adoc +++ b/test-files/golden-tests/core/libcxx.adoc @@ -34,7 +34,7 @@ Declared in `<libcxx.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename T> -<>::T +T sqrt(T value); ---- diff --git a/test-files/golden-tests/core/libcxx.html b/test-files/golden-tests/core/libcxx.html index c25e995c4..c9e8446a3 100644 --- a/test-files/golden-tests/core/libcxx.html +++ b/test-files/golden-tests/core/libcxx.html @@ -40,7 +40,7 @@

Synopsis

 
 template<typename T>
-std::T
+T
 sqrt(T value);
 
 
diff --git a/test-files/golden-tests/core/libcxx.xml b/test-files/golden-tests/core/libcxx.xml index 21ccb072d..fd7382674 100644 --- a/test-files/golden-tests/core/libcxx.xml +++ b/test-files/golden-tests/core/libcxx.xml @@ -7,7 +7,7 @@ - + diff --git a/test-files/golden-tests/snippets/sqrt.adoc b/test-files/golden-tests/snippets/sqrt.adoc index 4646f46c6..f357e6a0d 100644 --- a/test-files/golden-tests/snippets/sqrt.adoc +++ b/test-files/golden-tests/snippets/sqrt.adoc @@ -34,7 +34,7 @@ Declared in `<sqrt.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename T> -<>::T +T sqrt(T value); ---- diff --git a/test-files/golden-tests/snippets/sqrt.html b/test-files/golden-tests/snippets/sqrt.html index 6599acb71..e723b10a4 100644 --- a/test-files/golden-tests/snippets/sqrt.html +++ b/test-files/golden-tests/snippets/sqrt.html @@ -40,7 +40,7 @@

Synopsis

 
 template<typename T>
-std::T
+T
 sqrt(T value);
 
 
diff --git a/test-files/golden-tests/snippets/sqrt.xml b/test-files/golden-tests/snippets/sqrt.xml index 02350965b..6427b0ad3 100644 --- a/test-files/golden-tests/snippets/sqrt.xml +++ b/test-files/golden-tests/snippets/sqrt.xml @@ -7,7 +7,7 @@ - +