[clang] [clang][Parser] Fix FunctionDecl source range for out-of-class '= delete'/'= default' definitions (PR #167007)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 9 06:11:29 PST 2025
================
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -ast-dump %s | FileCheck %s
+
+// CHECK: FunctionDecl {{.*}} <{{.*}}:4:1, col:17> {{.*}}
+void f() = delete;
+
+
+struct S {
+ inline S();
+ ~S();
+};
+
+//CHECK: CXXConstructorDecl {{.*}} <{{.*}}:13:1, col:23> {{.*}}
+inline S::S() = default;
+//CHECK: CXXDestructorDecl {{.*}} <{{.*}}:15:1, col:17> {{.*}}
+S::~S() = default;
+
+template <typename T>
+class U {
+ U();
+ ~U();
+};
+
+//CHECK: CXXConstructorDecl {{.*}} <{{.*}}:24:1, line:25:19> {{.*}}
+template <typename T>
+U<T>::U() = default;
----------------
zwuis wrote:
Verifying line numbers is brittle. Other people may add something before this line. Ditto elsewhere.
You might consider writing code in one line.
```cpp
template ... = default;
```
https://github.com/llvm/llvm-project/pull/167007
More information about the cfe-commits
mailing list