[PATCH] D105478: [clang] Make CXXRecrdDecl invalid if it contains any undeduced fields.
Adam Czachorowski via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 7 05:37:45 PDT 2021
adamcz 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).
----------------
hokein wrote:
> 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.
I updated the change to mark a FieldDecl with undeduced type as invalid, thus making the record invalid too. Also added a test using -ast-dump to verify that both field and record are invalid, but kept the crash test too.
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