If the type is dependent, we should just discard it and not checking its
alignment as it doesn't exisit yet.
Fixes https://github.com/llvm/llvm-project/issues/58370
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaChecking.cpp | ||
---|---|---|
17397 | We don't typically use top-level const qualification. | |
17398–17399 | Hmm, is this logic correct? Don't we want: T->isDependentType() || (T->isPointerType() && (T->getPointeeType()->isIncompleteType() || Context.getTypeAlignInChars(T->getPointeeType()) <= MA->Alignment)) |
clang/lib/Sema/SemaChecking.cpp | ||
---|---|---|
17398–17399 | Why did you drop the T->isIntegerType()? | |
clang/test/SemaCXX/misaligned-member-with-depdent-type.cpp | ||
4 | I think since the bug report had malformed code, it would be worth it to include that case as well. |
clang/lib/Sema/SemaChecking.cpp | ||
---|---|---|
17398–17399 | Whoops! That's totally a typo on my part, I didn't intend to drop it. |
clang/lib/Sema/SemaChecking.cpp | ||
---|---|---|
17398–17399 |
There may be some misunderstanding here. So previously I hoist the pointer-related checks and put T->isDependentType() into it. After Aaron's words, I realized it was wrong so I changed the whole check condition to is T an integer type? || is T a dependent type ?|| is T a pointer type and other constraints (put them on the same level) That said you're looking at the old diff so there's nothing need to worried about :) |
We don't typically use top-level const qualification.