llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28k stars 11.56k forks source link

clang-tidy crash, when writing a wrong std::strong_ordering struct #53493

Open Febbe opened 2 years ago

Febbe commented 2 years ago

Calling

python llvm-lit.py -v modernize-use-trailing-return-type-cxx20.cpp
with `modernize-use-trailing-return-type-cxx20.cpp` ``` // RUN: %check_clang_tidy -std=c++20 %s modernize-use-trailing-return-type %t namespace std { template struct is_same { static constexpr auto value = false; }; template struct is_same { static constexpr auto value = true; }; template concept floating_point = std::is_same::value || std::is_same::value || std::is_same::value; } // // Concepts // std::floating_point auto con1(); // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}}auto con1() -> std::floating_point auto;{{$}} std::floating_point auto con1() { return 3.14f; } // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}}auto con1() -> std::floating_point auto { return 3.14f; }{{$}} namespace a { template concept Concept = true; template concept BinaryConcept = true; } a::Concept decltype(auto) con2(); // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}}auto con2() -> a::Concept decltype(auto);{{$}} a::BinaryConcept decltype(auto) con3(); // CHECK-MESSAGES: :[[@LINE-1]]:38: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}}auto con3() -> a::BinaryConcept decltype(auto);{{$}} const std::floating_point auto* volatile con4(); // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}}auto con4() -> const std::floating_point auto* volatile;{{$}} template int req1(T t) requires std::floating_point; // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}}auto req1(T t) -> int requires std::floating_point;{{$}} template T req2(T t) requires requires { t + t; }; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}}auto req2(T t) -> T requires requires { t + t; };{{$}} // // Operator c++20 defaulted comparison operators // // Requires namespace std { struct strong_ordering { enum class Val { less = -1, equal = 0, greater = 1, }; static auto const less = Val::less; static auto const equal = Val::equal; static auto const equivalent = Val::equal; static auto const greater = Val::greater; constexpr operator==(Val const &val) const { return this->val == val; } constexpr operator!=(Val const &val) const { return this->val != val; } /* template friend constexpr auto operator==(strong_ordering v, T u) noexcept -> bool requires { T{0}; } { return v.val == u; } friend constexpr auto operator==(strong_ordering v, strong_ordering w) noexcept -> bool = default; */ Val val{}; }; } // namespace std struct TestDefaultOperatorA { int a{}; int b{}; friend auto operator<=>(const TestDefaultOperatorA &, const TestDefaultOperatorA &) noexcept = default; }; struct TestDefaultOperatorB { int a{}; int b{}; friend auto operator==(const TestDefaultOperatorB &, const TestDefaultOperatorB &) noexcept -> bool = default; friend bool operator<(const TestDefaultOperatorB &, const TestDefaultOperatorB &) noexcept = default; // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}} friend auto operator<(const TestDefaultOperatorB &, const TestDefaultOperatorB &) noexcept -> bool = default;{{$}} }; ```

Crashes with

PS D:\Febbe\workspace\llvm-project\build\bin> python llvm-lit.py -v d:\Febbe\workspace\llvm-project\clang-tools-extra\test\clang-tidy\checkers\modernize-use-trailing-return-type-cxx20.cpp
llvm-lit.py: D:\Febbe\workspace\llvm-project\llvm\utils\lit\lit\llvm\config.py:46: note: using lit tools: C:\Program Files\Git\usr\bin
-- Testing: 1 tests, 1 workers --
FAIL: Clang Tools :: clang-tidy/checkers/modernize-use-trailing-return-type-cxx20.cpp (1 of 1)
******************** TEST 'Clang Tools :: clang-tidy/checkers/modernize-use-trailing-return-type-cxx20.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1';   C:/Users/Febbe/AppData/Local/Programs/Python/Python39/python.exe D:/Febbe/workspace/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py -std=c++20 D:\Febbe\workspace\llvm-project\clang-tools-extra\test\clang-tidy\checkers\modernize-use-trailing-return-type-cxx20.cpp modernize-use-trailing-return-type D:\Febbe\workspace\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\Output\modernize-use-trailing-return-type-cxx20.cpp.tmp
--
Exit Code: 1

Command Output (stdout):
--
$ ":" "RUN: at line 1"
$ "C:/Users/Febbe/AppData/Local/Programs/Python/Python39/python.exe" "D:/Febbe/workspace/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py" "-std=c++20" "D:\Febbe\workspace\llvm-project\clang-tools-extra\test\clang-tidy\checkers\modernize-use-trailing-return-type-cxx20.cpp" "modernize-use-trailing-return-type" "D:\Febbe\workspace\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\Output\modernize-use-trailing-return-type-cxx20.cpp.tmp"
# command output:
Running ['clang-tidy', 'D:\\Febbe\\workspace\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\Output\\modernize-use-trailing-return-type-cxx20.cpp.tmp.cpp', '-fix', '--checks=-*,modernize-use-trailing-return-type', '-config={}', '--', '-std=c++20', '-nostdinc++']...
clang-tidy D:\Febbe\workspace\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\Output\modernize-use-trailing-return-type-cxx20.cpp.tmp.cpp -fix --checks=-*,modernize-use-trailing-return-type -config={} -- -std=c++20 -nostdinc++ failed:
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: clang-tidy D:\\Febbe\\workspace\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\Output\\modernize-use-trailing-return-type-cxx20.cpp.tmp.cpp -fix --checks=-*,modernize-use-trailing-return-type -config={} -- -std=c++20 -nostdinc++
1.      D:\Febbe\workspace\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\Output\modernize-use-trailing-return-type-cxx20.cpp.tmp.cpp:91:2: current parser token ';'
2.      D:\Febbe\workspace\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\Output\modernize-use-trailing-return-type-cxx20.cpp.tmp.cpp:86:1: parsing struct/union/class body 'TestDefaultOperatorA'
 #0 0x00007ff7cfd06e20 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1296e20)
 #1 0x00007ff7cff46e7e (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x14d6e7e)
 #2 0x00007ff7cef82a56 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x512a56)
 #3 0x00007ff7cef8ba62 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x51ba62)
 #4 0x00007ff7cef8be3b (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x51be3b)
 #5 0x00007ff7cef846ff (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x5146ff)
 #6 0x00007ff7cef7190c (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x50190c)
 #7 0x00007ff7d091cbf4 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1eacbf4)
 #8 0x00007ff7d091e2f6 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1eae2f6)
 #9 0x00007ff7d08b2274 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1e42274)
#10 0x00007ff7d088ae97 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1e1ae97)
#11 0x00007ff7d088c259 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1e1c259)
#12 0x00007ff7d089076e (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1e2076e)
#13 0x00007ff7d08871f2 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1e171f2)
#14 0x00007ff7d070e805 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1c9e805)
#15 0x00007ff7d070e618 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1c9e618)
#16 0x00007ff7d06f5b5a (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1c85b5a)
#17 0x00007ff7d0164ed5 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x16f4ed5)
#18 0x00007ff7d0191b32 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x1721b32)
#19 0x00007ff7d01650c9 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x16f50c9)
#20 0x00007ff7d0164c04 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x16f4c04)
#21 0x00007ff7d0164160 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x16f4160)
#22 0x00007ff7d019198c (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x172198c)
#23 0x00007ff7ceaad3b0 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0x3d3b0)
#24 0x00007ff7cf8958a8 (D:\Febbe\workspace\llvm-project\build\bin\clang-tidy.exe+0xe258a8)
#25 0x00007ffcc70d7034 (C:\WINDOWS\System32\KERNEL32.DLL+0x17034)
#26 0x00007ffcc8202651 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x52651)

# command stderr:
Traceback (most recent call last):
  File "D:\Febbe\workspace\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 260, in <module>
    main()
  File "D:\Febbe\workspace\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 256, in main
    CheckRunner(args, extra_args).run()
  File "D:\Febbe\workspace\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 207, in run
    clang_tidy_output = self.run_clang_tidy()
  File "D:\Febbe\workspace\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 168, in run_clang_tidy
    clang_tidy_output = try_run(args)
  File "D:\Febbe\workspace\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 45, in try_run
    subprocess.check_output(args, stderr=subprocess.STDOUT).decode(errors='ignore')
  File "c:\users\febbe\appdata\local\programs\python\python39\lib\subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "c:\users\febbe\appdata\local\programs\python\python39\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['clang-tidy', 'D:\\Febbe\\workspace\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\Output\\modernize-use-trailing-return-type-cxx20.cpp.tmp.cpp', '-fix', '--checks=-*,modernize-use-trailing-return-type', '-config={}', '--', '-std=c++20', '-nostdinc++']' returned non-zero exit status 3221225477.

error: command failed with exit status: 1

--

********************
********************
Failed Tests (1):
  Clang Tools :: clang-tidy/checkers/modernize-use-trailing-return-type-cxx20.cpp

Testing Time: 1.91s
  Failed: 1
llvmbot commented 2 years ago

@llvm/issue-subscribers-bug

llvmbot commented 2 years ago

@llvm/issue-subscribers-clang-tidy

PiotrZSL commented 1 year ago
0.      Program arguments: clang-tidy /data/llvm-project/.build/tools/clang/tools/extra/test/clang-tidy/checkers/modernize/Output/use-trailing-return-type-cxx20.cpp.tmp.cpp -fix --checks=-*,modernize-use-trailing-return-type --config={} -- -std=c++20 -nostdinc++
1.      /data/llvm-project/.build/tools/clang/tools/extra/test/clang-tidy/checkers/modernize/Output/use-trailing-return-type-cxx20.cpp.tmp.cpp:91:2: current parser token ';'
2.      /data/llvm-project/.build/tools/clang/tools/extra/test/clang-tidy/checkers/modernize/Output/use-trailing-return-type-cxx20.cpp.tmp.cpp:86:1: parsing struct/union/class body 'TestDefaultOperatorA'
 #0 0x0000558820285e47 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /data/llvm-project/llvm/lib/Support/Unix/Signals.inc:567:13
 #1 0x0000558820283c9e llvm::sys::RunSignalHandlers() /data/llvm-project/llvm/lib/Support/Signals.cpp:105:18
 #2 0x00005588202867aa SignalHandler(int) /data/llvm-project/llvm/lib/Support/Unix/Signals.inc:412:1
 #3 0x00007fe2782a4cf0 (/lib/x86_64-linux-gnu/libc.so.6+0x3bcf0)
 #4 0x000055882044a5e3 hasExternalLexicalStorage /data/llvm-project/clang/include/clang/AST/DeclBase.h:2500:12
 #5 0x000055882044a5e3 clang::RecordDecl::field_begin() const /data/llvm-project/clang/lib/AST/Decl.cpp:4767:7
 #6 0x0000558820804128 operator!= /data/llvm-project/clang/include/clang/AST/DeclBase.h:2176:24
 #7 0x0000558820804128 operator!= /data/llvm-project/clang/include/clang/AST/DeclBase.h:2266:24
 #8 0x0000558820804128 __distance<clang::DeclContext::specific_decl_iterator<clang::FieldDecl> > /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_iterator_base_funcs.h:88:22
 #9 0x0000558820804128 distance<clang::DeclContext::specific_decl_iterator<clang::FieldDecl> > /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_iterator_base_funcs.h:150:14
#10 0x0000558820804128 clang::ComparisonCategoryInfo::ValueInfo::hasValidIntValue() const /data/llvm-project/clang/lib/AST/ComparisonCategories.cpp:52:7
#11 0x00005588227a43bb clang::Sema::CheckComparisonCategoryType(clang::ComparisonCategoryType, clang::SourceLocation, clang::Sema::ComparisonCategoryUsage) /data/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:11514:9
#12 0x00005588227a1539 clang::Sema::CheckExplicitlyDefaultedComparison(clang::Scope*, clang::FunctionDecl*, clang::Sema::DefaultedComparisonKind) /data/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:8791:20
#13 0x000055882279ee33 clang::Sema::CheckExplicitlyDefaultedFunction(clang::Scope*, clang::FunctionDecl*) /data/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:7457:7
#14 0x000055882279c916 clang::Sema::CheckCompletedCXXClass(clang::Scope*, clang::CXXRecordDecl*) /data/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:0:5
#15 0x00005588227a7527 clang::Sema::ActOnFinishCXXMemberSpecification(clang::Scope*, clang::SourceLocation, clang::Decl*, clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesView const&) /data/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:10227:1
#16 0x0000558822278de9 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) /data/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3611:7
#17 0x00005588222765bc clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) /data/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:0:7
#18 0x000055882229977f empty /data/llvm-project/llvm/include/llvm/ADT/SmallVector.h:94:46
#19 0x000055882229977f empty /data/llvm-project/clang/include/clang/Sema/ParsedAttr.h:932:40
#20 0x000055882229977f clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) /data/llvm-project/clang/lib/Parse/ParseDecl.cpp:4237:23
#21 0x0000558822227b57 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /data/llvm-project/clang/lib/Parse/Parser.cpp:1125:10
#22 0x0000558822227809 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /data/llvm-project/clang/lib/Parse/Parser.cpp:1227:12
#23 0x00005588222267e5 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) /data/llvm-project/clang/lib/Parse/Parser.cpp:0:14
#24 0x000055882222463f clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) /data/llvm-project/clang/lib/Parse/Parser.cpp:744:10
#25 0x000055882221f1ce clang::ParseAST(clang::Sema&, bool, bool) /data/llvm-project/clang/lib/Parse/ParseAST.cpp:161:5
#26 0x0000558821f999b0 clang::FrontendAction::Execute() /data/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1062:10
#27 0x0000558821f066bf getPtr /data/llvm-project/llvm/include/llvm/Support/Error.h:272:42
#28 0x0000558821f066bf operator bool /data/llvm-project/llvm/include/llvm/Support/Error.h:235:16
#29 0x0000558821f066bf clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /data/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1049:23
#30 0x00005588203035ce clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) /data/llvm-project/clang/lib/Tooling/Tooling.cpp:434:33
#31 0x000055882034db88 clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef)::ActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) /data/llvm-project/clang-tools-extra/clang-tidy/ClangTidy.cpp:559:37
#32 0x0000558820303366 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) /data/llvm-project/clang/lib/Tooling/Tooling.cpp:409:18
#33 0x0000558820301d58 clang::tooling::ToolInvocation::run() /data/llvm-project/clang/lib/Tooling/Tooling.cpp:394:10
#34 0x000055882030503b clang::tooling::ClangTool::run(clang::tooling::ToolAction*) /data/llvm-project/clang/lib/Tooling/Tooling.cpp:588:11
#35 0x00005588203488a2 clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) /data/llvm-project/clang-tools-extra/clang-tidy/ClangTidy.cpp:0:8
#36 0x0000558820251898 clang::tidy::clangTidyMain(int, char const**) /data/llvm-project/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp:659:7
#37 0x00007fe27828c510 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#38 0x00007fe27828c5c9 call_init ./csu/../csu/libc-start.c:128:20
#39 0x00007fe27828c5c9 __libc_start_main ./csu/../csu/libc-start.c:368:5
#40 0x000055882024cb65 _start (/data/llvm-project/.build/bin/clang-tidy+0x36a2b65)
PiotrZSL commented 1 year ago
Cause of crash is in clang/lib/AST/ComparisonCategories.cpp:51 ( auto *Record = VD->getType()->getAsCXXRecordDecl();)

We expecting record but we get:
QualType 0x5642fe4924c1 'const enum std::strong_ordering::Val' const
`-AutoType 0x5642fe4924c0 'enum std::strong_ordering::Val' sugar
  `-EnumType 0x5642fe490c50 'enum std::strong_ordering::Val'
    `-Enum 0x5642fe490b90 'Val'

and then there is nullptr dereference.

I dont know how this should be fixed, returning from this function with true/false causes: error: a type specifier is required for all declarations [clang-diagnostic-error]

so probably this should be fixed in other way.

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-frontend

PiotrZSL commented 7 months ago

Crashes also on Clang:

1.cpp:42:46: warning: volatile-qualified return type 'const floating_point auto *volatile' is deprecated [-Wdeprecated-volatile]
   42 | const std::floating_point auto* volatile con4();
      |                                              ^
1.cpp:71:13: error: a type specifier is required for all declarations
   71 |   constexpr operator==(Val const &val) const { return this->val == val; }
      |   ~~~~~~~~~ ^
1.cpp:72:13: error: a type specifier is required for all declarations
   72 |   constexpr operator!=(Val const &val) const { return this->val != val; }
      |   ~~~~~~~~~ ^
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang++ -c 1.cpp -std=c++23
1.      1.cpp:91:2: current parser token ';'
2.      1.cpp:86:1: parsing struct/union/class body 'TestDefaultOperatorA'
 #0 0x00007f721311c1ca llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-19/bin/../lib/libLLVM-19.so.1+0xd951ca)
 #1 0x00007f7213119f64 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-19/bin/../lib/libLLVM-19.so.1+0xd92f64)
 #2 0x00007f7213067c14 (/usr/lib/llvm-19/bin/../lib/libLLVM-19.so.1+0xce0c14)
 #3 0x00007f7211e2c910 (/lib/x86_64-linux-gnu/libc.so.6+0x42910)
 #4 0x00007f721a87a7d3 clang::RecordDecl::field_begin() const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0xe227d3)
 #5 0x00007f721a862fd5 clang::ComparisonCategoryInfo::ValueInfo::hasValidIntValue() const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0xe0afd5)
 #6 0x00007f721b07e467 clang::Sema::CheckComparisonCategoryType(clang::ComparisonCategoryType, clang::SourceLocation, clang::Sema::ComparisonCategoryUsage) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x1626467)
 #7 0x00007f721b07b8a4 clang::Sema::CheckExplicitlyDefaultedComparison(clang::Scope*, clang::FunctionDecl*, clang::Sema::DefaultedComparisonKind) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x16238a4)
 #8 0x00007f721b0791ec clang::Sema::CheckExplicitlyDefaultedFunction(clang::Scope*, clang::FunctionDecl*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x16211ec)
 #9 0x00007f721b07693d clang::Sema::CheckCompletedCXXClass(clang::Scope*, clang::CXXRecordDecl*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x161e93d)
#10 0x00007f721b08108d clang::Sema::ActOnFinishCXXMemberSpecification(clang::Scope*, clang::SourceLocation, clang::Decl*, clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesView const&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x162908d)
#11 0x00007f721a62b5a7 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0xbd35a7)
#12 0x00007f721a628d0d clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0xbd0d0d)
#13 0x00007f721a609af8 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0xbb1af8)
#14 0x00007f721a6bcb5f clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0xc64b5f)
#15 0x00007f721a6bc8af clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0xc648af)
#16 0x00007f721a6bbaeb clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0xc63aeb)
#17 0x00007f721a6b9f5a clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0xc61f5a)
#18 0x00007f721a5efdae clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0xb97dae)
#19 0x00007f721c463869 clang::FrontendAction::Execute() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x2a0b869)
#20 0x00007f721c3d9864 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x2981864)
#21 0x00007f721c4dc17e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x2a8417e)
#22 0x000056115685d676 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-19/bin/clang+0x14676)
#23 0x000056115685a945 (/usr/lib/llvm-19/bin/clang+0x11945)
#24 0x00007f721c08838d (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x263038d)
#25 0x00007f72130679a4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/llvm-19/bin/../lib/libLLVM-19.so.1+0xce09a4)
#26 0x00007f721c087ca2 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x262fca2)
#27 0x00007f721c04fd17 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x25f7d17)
#28 0x00007f721c04ff6e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x25f7f6e)
#29 0x00007f721c06c81d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19+0x261481d)
#30 0x000056115685a29d clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-19/bin/clang+0x1129d)
#31 0x000056115686787a main (/usr/lib/llvm-19/bin/clang+0x1e87a)
#32 0x00007f7211e120d0 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#33 0x00007f7211e12189 call_init ./csu/../csu/libc-start.c:128:20
#34 0x00007f7211e12189 __libc_start_main ./csu/../csu/libc-start.c:347:5
#35 0x00005611568572a5 _start (/usr/lib/llvm-19/bin/clang+0xe2a5)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Ubuntu clang version 19.0.0 (++20240131083553+96c907dbcebd-1~exp1~20240131083715.288)