llvm-project/clang/lib/Parse
Akira Hatanaka 12ddceecde [Sema] Fix a crash-on-invalid when a template parameter list has a class
definition or non-reference class type.

The crash occurs when there is a template parameter list in a class that
is missing the closing angle bracket followed by a definition of a
struct. For example:

class C0 {
public:
  template<typename T, typename T1 = T // missing closing angle bracket
  struct S0 {};

  C0() : m(new S0<int>) {}
  S0<int> *m;
};

This happens because the parsed struct is added to the scope of the
enclosing class without having its access specifier set, which results
in an assertion failure in SemaAccess.cpp later.

This commit fixes the crash by adding the parsed struct to the enclosing
file scope and marking structs as invalid if they are defined in
template parameter lists.

rdar://problem/31783961
rdar://problem/19570630

Differential Revision: https://reviews.llvm.org/D33606

llvm-svn: 306317
2017-06-26 18:46:12 +00:00
..
CMakeLists.txt [CMake] Reorder libdeps by alphabetical order. 2014-07-14 04:59:27 +00:00
ParseAST.cpp C++ Modules TS: add frontend support for building pcm files from module 2016-08-26 00:14:38 +00:00
ParseCXXInlineMethods.cpp Fix the location of "missing ';'" suggestions after annotation tokens. 2017-05-18 19:21:48 +00:00
ParseDecl.cpp [Sema] Fix a crash-on-invalid when a template parameter list has a class 2017-06-26 18:46:12 +00:00
ParseDeclCXX.cpp [Sema] Fix a crash-on-invalid when a template parameter list has a class 2017-06-26 18:46:12 +00:00
ParseExpr.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-01 21:21:49 +00:00
ParseExprCXX.cpp [NFC, Refactor] Modernize TemplateIdAnnotation using TrailingObjects 2017-05-23 01:07:12 +00:00
ParseInit.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-01 21:23:52 +00:00
ParseObjc.cpp [Parser][ObjC] Use an artificial EOF token while parsing lexed ObjC methods 2017-06-19 17:53:21 +00:00
ParseOpenMP.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-01 21:26:38 +00:00
ParsePragma.cpp Add support for #pragma clang section 2017-06-05 10:11:57 +00:00
ParseStmt.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-01 21:28:26 +00:00
ParseStmtAsm.cpp Spelling mistakes in comments. NFCI. (PR27635) 2017-03-30 14:13:19 +00:00
ParseTemplate.cpp [Sema] Fix a crash-on-invalid when a template parameter list has a class 2017-06-26 18:46:12 +00:00
ParseTentative.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-01 21:29:45 +00:00
Parser.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-03 06:29:16 +00:00