Commit f0288384 authored by Bill Wendling's avatar Bill Wendling
Browse files

Merging r155289:

------------------------------------------------------------------------
r155289 | rsmith | 2012-04-21 10:47:47 -0700 (Sat, 21 Apr 2012) | 3 lines

Fix serialization of uninstantiated exception specifications. Patch by Li Kan,
test by me.

------------------------------------------------------------------------

llvm-svn: 156681
parent dd80f8b5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3866,6 +3866,9 @@ QualType ASTReader::readTypeRecord(unsigned Index) {
      EPI.Exceptions = Exceptions.data();
    } else if (EST == EST_ComputedNoexcept) {
      EPI.NoexceptExpr = ReadExpr(*Loc.F);
    } else if (EST == EST_Uninstantiated) {
      EPI.ExceptionSpecDecl = ReadDeclAs<FunctionDecl>(*Loc.F, Record, Idx);
      EPI.ExceptionSpecTemplate = ReadDeclAs<FunctionDecl>(*Loc.F, Record, Idx);
    }
    return Context.getFunctionType(ResultType, ParamTypes.data(), NumParams,
                                    EPI);
+3 −0
Original line number Diff line number Diff line
@@ -195,6 +195,9 @@ void ASTTypeWriter::VisitFunctionProtoType(const FunctionProtoType *T) {
      Writer.AddTypeRef(T->getExceptionType(I), Record);
  } else if (T->getExceptionSpecType() == EST_ComputedNoexcept) {
    Writer.AddStmt(T->getNoexceptExpr());
  } else if (T->getExceptionSpecType() == EST_Uninstantiated) {
    Writer.AddDeclRef(T->getExceptionSpecDecl(), Record);
    Writer.AddDeclRef(T->getExceptionSpecTemplate(), Record);
  }
  Code = TYPE_FUNCTION_PROTO;
}
+17 −0
Original line number Diff line number Diff line
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s

#ifndef HEADER_INCLUDED

#define HEADER_INCLUDED

template<bool b> int f() noexcept(b) {}
decltype(f<false>()) a;
decltype(f<true>()) b;

#else

static_assert(!noexcept(f<false>()), "");
static_assert(noexcept(f<true>()), "");

#endif