Fznamznon updated this revision to Diff 513575.
Fznamznon added a comment.
Rebase, fix error message
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148330/new/
https://reviews.llvm.org/D148330
Files:
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaCXXScopeSpec.cpp
clang/test/SemaCXX/undefined-partial-specialization.cpp
Index: clang/test/SemaCXX/undefined-partial-specialization.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaCXX/undefined-partial-specialization.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -std=c++20 -verify %s
+
+namespace GH61356 {
+
+template <typename T, bool b>
+class boo {void foo();};
+
+template <typename T>
+class boo<T, true>;
+
+template<typename T>
+void boo<T, true>::foo(){} // expected-error{{out-of-line definition of 'foo'
from class 'boo<type-parameter-0-0, true>' without definition}}
+
+}
Index: clang/lib/Sema/SemaCXXScopeSpec.cpp
===================================================================
--- clang/lib/Sema/SemaCXXScopeSpec.cpp
+++ clang/lib/Sema/SemaCXXScopeSpec.cpp
@@ -131,7 +131,8 @@
// entering the context, and that can't happen in a SFINAE context.
assert(!isSFINAEContext() && "partial specialization scope "
"specifier in SFINAE context?");
- if (!hasReachableDefinition(PartialSpec))
+ if (PartialSpec->hasDefinition() &&
+ !hasReachableDefinition(PartialSpec))
diagnoseMissingImport(SS.getLastQualifierNameLoc(), PartialSpec,
MissingImportKind::PartialSpecialization,
true);
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -303,6 +303,8 @@
- Fix a failed assertion due to an invalid source location when trying to form
a coverage report for an unresolved constructor expression.
(`#62105 <https://github.com/llvm/llvm-project/issues/62105>`_)
+- Fix crash when handling undefined template partial specialization
+ (`#61356 <https://github.com/llvm/llvm-project/issues/61356>`_)
Bug Fixes to Compiler Builtins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Index: clang/test/SemaCXX/undefined-partial-specialization.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaCXX/undefined-partial-specialization.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -std=c++20 -verify %s
+
+namespace GH61356 {
+
+template <typename T, bool b>
+class boo {void foo();};
+
+template <typename T>
+class boo<T, true>;
+
+template<typename T>
+void boo<T, true>::foo(){} // expected-error{{out-of-line definition of 'foo' from class 'boo<type-parameter-0-0, true>' without definition}}
+
+}
Index: clang/lib/Sema/SemaCXXScopeSpec.cpp
===================================================================
--- clang/lib/Sema/SemaCXXScopeSpec.cpp
+++ clang/lib/Sema/SemaCXXScopeSpec.cpp
@@ -131,7 +131,8 @@
// entering the context, and that can't happen in a SFINAE context.
assert(!isSFINAEContext() && "partial specialization scope "
"specifier in SFINAE context?");
- if (!hasReachableDefinition(PartialSpec))
+ if (PartialSpec->hasDefinition() &&
+ !hasReachableDefinition(PartialSpec))
diagnoseMissingImport(SS.getLastQualifierNameLoc(), PartialSpec,
MissingImportKind::PartialSpecialization,
true);
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -303,6 +303,8 @@
- Fix a failed assertion due to an invalid source location when trying to form
a coverage report for an unresolved constructor expression.
(`#62105 <https://github.com/llvm/llvm-project/issues/62105>`_)
+- Fix crash when handling undefined template partial specialization
+ (`#61356 <https://github.com/llvm/llvm-project/issues/61356>`_)
Bug Fixes to Compiler Builtins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits