Index: lib/Sema/SemaExpr.cpp =================================================================== --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -14044,6 +14044,9 @@ if (ReturnType->isVoidType() || !ReturnType->isIncompleteType()) return false; + if (Loc.isInvalid()) + return true; + // If we're inside a decltype's expression, don't check for a valid return // type or construct temporaries until we know whether this is the last call. if (ExprEvalContexts.back().IsDecltype) { Index: test/Sema/PR25668.cpp =================================================================== --- /dev/null +++ test/Sema/PR25668.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -std=c++11 %s +// expected-no-assertion-crash + +template class A {}; +struct B { + A operator[](int); +} mask_ { + mask[2]; // expected-error{{use of undeclared identifier 'mask'}} +};