1*67e74705SXin Li // RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic 2*67e74705SXin Li // Check that we don't crash trying to emit warnings in a potentially-evaluated 3*67e74705SXin Li // sizeof or typeof. (This test needs to be in a separate file because we use 4*67e74705SXin Li // a different codepath when we have already emitted an error.) 5*67e74705SXin Li PotentiallyEvaluatedSizeofWarn(int n)6*67e74705SXin Liint PotentiallyEvaluatedSizeofWarn(int n) { 7*67e74705SXin Li return (int)sizeof *(0 << 32,(int(*)[n])0); // expected-warning {{expression result unused}} expected-warning {{shift count >= width of type}} 8*67e74705SXin Li } 9*67e74705SXin Li PotentiallyEvaluatedTypeofWarn(int n)10*67e74705SXin Livoid PotentiallyEvaluatedTypeofWarn(int n) { 11*67e74705SXin Li __typeof(*(0 << 32,(int(*)[n])0)) x; // expected-warning {{expression result unused}} expected-warning {{shift count >= width of type}} 12*67e74705SXin Li (void)x; 13*67e74705SXin Li } 14*67e74705SXin Li PotentiallyEvaluatedArrayBoundWarn(int n)15*67e74705SXin Livoid PotentiallyEvaluatedArrayBoundWarn(int n) { 16*67e74705SXin Li (void)*(int(*)[(0 << 32,n)])0; // FIXME: We should warn here. 17*67e74705SXin Li } 18