From 76945821b9cad3baebad5c36ae00ab173f8529c6 Mon Sep 17 00:00:00 2001 From: Elizabeth Andrews Date: Tue, 13 Aug 2019 15:53:19 +0000 Subject: 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 llvm-svn: 368706 --- clang/test/SemaTemplate/enum-argument.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'clang/test/SemaTemplate/enum-argument.cpp') diff --git a/clang/test/SemaTemplate/enum-argument.cpp b/clang/test/SemaTemplate/enum-argument.cpp index 7ff41961399..a79ed8403e9 100644 --- a/clang/test/SemaTemplate/enum-argument.cpp +++ b/clang/test/SemaTemplate/enum-argument.cpp @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -// expected-no-diagnostics enum Enum { val = 1 }; template struct C { @@ -31,7 +30,7 @@ namespace rdar8020920 { unsigned long long bitfield : e0; void f(int j) { - bitfield + j; + bitfield + j; // expected-warning {{expression result unused}} } }; } -- cgit v1.2.3