[PATCH] D105478: [clang] Make CXXRecrdDecl invalid if it contains any undeduced fields.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 7 00:19:57 PDT 2021


hokein added inline comments.


================
Comment at: clang/test/SemaCXX/cxx11-crashes.cpp:117
+  // The missing expression makes A undeduced.
+  static constexpr auto A = ;  // expected-error {{expected expression}}
+  Foo<decltype(A)>::type B;  // The type of B is also undeduced (wrapped in Elaborated).
----------------
I think the root cause is that this incomplete var declaration is marked valid.

Looks like there are a few inconsistencies in clang:

```
struct Bar {
  static constexpr auto A1; // case1: invalid
  static constexpr auto A2 = ; // case2: valid
};

// static var decl in global context
static constexpr auto A3; // case3: invalid
static constexpr auto A4 = ; // case4: invalid
```

so it looks like marking case2 valid is a bug, I think we should invalidate it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105478/new/

https://reviews.llvm.org/D105478



More information about the cfe-commits mailing list