[clang][Sema] Don't try to initialize implicit variable of invalid anonymous union...
authorTa-Wei Tu <tu.da.wei@gmail.com>
Wed, 31 Mar 2021 01:05:24 +0000 (09:05 +0800)
committerTa-Wei Tu <tu.da.wei@gmail.com>
Wed, 31 Mar 2021 01:05:45 +0000 (09:05 +0800)
commit99fd0662278470f5405b8abd79b681b96cac7856
tree74ce83e677595f0becaa58edea34605510c0ec77
parenta4ee79c8ae5ca1bbfa8d78a2782918d1f23f15b2
[clang][Sema] Don't try to initialize implicit variable of invalid anonymous union/struct

This fixes https://bugs.llvm.org/show_bug.cgi?id=49534, where the call to the constructor
of the anonymous union is checked and triggers assertion failure when trying to retrieve
the alignment of the `this` argument (which is a union with virtual function).

The extra check for alignment was introduced in D97187.

Reviewed By: tmatheson

Differential Revision: https://reviews.llvm.org/D98548
clang/lib/Sema/SemaDecl.cpp
clang/test/SemaCXX/PR49534.cpp [new file with mode: 0644]