Skip to content

Conversation

dyung
Copy link
Collaborator

@dyung dyung commented Aug 20, 2025

The test added for #154418 specifically tests for a warning that the compiler should emit informing the user that a feature is a C++20 extension, but the compiler does not emit that when the default is C++20, so we should skip that test. This change checks whether the C++ default standard is less than C++20, and if so, skips the test.

@dyung dyung requested review from mizvekov and cor3ntin August 20, 2025 03:49
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Aug 20, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 20, 2025

@llvm/pr-subscribers-clang

Author: None (dyung)

Changes

The test added for #154418 specifically tests for a warning that the compiler should emit informing the user that a feature is a C++20 extension, but the compiler does not emit that when the default is C++20, so we should skip that test. This change checks whether the C++ default standard is less than C++20, and if so, skips the test.


Full diff: https://github.com/llvm/llvm-project/pull/154463.diff

1 Files Affected:

  • (modified) clang/test/SemaTemplate/nested-name-spec-template.cpp (+1-1)
diff --git a/clang/test/SemaTemplate/nested-name-spec-template.cpp b/clang/test/SemaTemplate/nested-name-spec-template.cpp
index c99e1eed456cc..833f76218212a 100644
--- a/clang/test/SemaTemplate/nested-name-spec-template.cpp
+++ b/clang/test/SemaTemplate/nested-name-spec-template.cpp
@@ -168,7 +168,7 @@ namespace unresolved_using {
   template struct C<int>;
 } // namespace unresolved_using
 
-#if __cplusplus >= 201703L
+#if (__cplusplus >= 201703L && __cplusplus < 202002L)
 namespace SubstTemplateTypeParmPackType {
   template <int...> struct A {};
 

@dyung dyung changed the title Fix test added in #154418 to work when the default is C++20. Skip test added in #154418 to work when the default is C++20. Aug 20, 2025
@mizvekov
Copy link
Contributor

Any other alternative would be preferable over skipping the test altogether.

My suggestion is to disable that warning on the command line and then simply delete that expected-warning line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add -std=c++17 and change -verify to -verify=expected,cxx17 so that we can use // cxx17-warning {{...}} instead of adding #if block for some test cases. See https://clang.llvm.org/docs/InternalsManual.html#testing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's also better than disabling the test, but we don't need to test that we produce this warning, this test is not about that. It's a regression test for a crash and the warning is irrelevant.

@dyung
Copy link
Collaborator Author

dyung commented Aug 20, 2025

Any other alternative would be preferable over skipping the test altogether.

My suggestion is to disable that warning on the command line and then simply delete that expected-warning line.

Oh thanks, I didn't realize this was just testing for a crash rather than conformance type warning. I'll update the test to do as you suggest.

@dyung dyung changed the title Skip test added in #154418 to work when the default is C++20. Update test added in #154418 to work when the default is C++20. Aug 20, 2025
Copy link
Contributor

@mizvekov mizvekov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@dyung dyung merged commit 18e6cfd into llvm:main Aug 20, 2025
9 checks passed
@dyung dyung deleted the fix-test-for-c++20 branch August 20, 2025 04:39
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 20, 2025

LLVM Buildbot has detected a new failure on builder arc-builder running on arc-worker while building clang at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/20819

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: 1200 seconds without output running [b'ninja', b'check-all'], attempting to kill
...
11.482 [1/11/47] Linking CXX executable unittests/Target/TargetMachineCTests
11.584 [1/10/48] Linking CXX executable unittests/ExecutionEngine/MCJIT/MCJITTests
12.006 [1/9/49] Linking CXX executable unittests/Passes/PassBuilderBindings/PassesBindingsTests
12.401 [1/8/50] Linking CXX executable unittests/Transforms/Utils/UtilsTests
12.737 [1/7/51] Linking CXX executable unittests/Passes/Plugins/PluginsTests
13.218 [1/6/52] Linking CXX executable unittests/tools/llvm-mca/LLVMMCATests
13.432 [1/5/53] Linking CXX executable unittests/Target/X86/X86Tests
13.811 [1/4/54] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
16.023 [1/3/55] Linking CXX executable tools/clang/unittests/Interpreter/ClangReplInterpreterTests
16.957 [1/2/56] Linking CXX executable tools/clang/unittests/Interpreter/ExceptionTests/ClangReplInterpreterExceptionTests
command timed out: 1200 seconds without output running [b'ninja', b'check-all'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=1217.763807

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants