summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorElizabeth Andrews <elizabeth.andrews@intel.com>2019-08-13 15:53:19 +0000
committerElizabeth Andrews <elizabeth.andrews@intel.com>2019-08-13 15:53:19 +0000
commit318c63ccf2beb63e6f49c990eb3754180d36800b (patch)
tree198f816a70c2b9a454a25744e292327b59cd25f2 /lib/Sema/SemaChecking.cpp
parent36584d3c82a7ce4d545e8a66ae38e00533f1cc0f (diff)
downloadclang-318c63ccf2beb63e6f49c990eb3754180d36800b.tar.gz
Fix crash on switch conditions of non-integer types in templates
Clang currently crashes for switch statements inside a template when the condition is a non-integer field. The crash is due to incorrect type-dependency of field. Type-dependency of member expressions is currently set based on the containing class. This patch changes this for 'members of the current instantiation' to set the type dependency based on the member's type instead. A few lit tests started to fail once I applied this patch because errors are now diagnosed earlier (does not wait till instantiation). I've modified these tests in this patch as well. Patch fixes PR#40982 Differential Revision: https://reviews.llvm.org/D61027 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368706 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r--lib/Sema/SemaChecking.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 3225dffe92..9df5599728 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -14288,6 +14288,8 @@ void Sema::RefersToMemberWithReducedAlignment(
bool AnyIsPacked = false;
do {
QualType BaseType = ME->getBase()->getType();
+ if (BaseType->isDependentType())
+ return;
if (ME->isArrow())
BaseType = BaseType->getPointeeType();
RecordDecl *RD = BaseType->getAs<RecordType>()->getDecl();