<div dir="ltr">Hi Richard,<div><br></div><div>I think that this commit has caused a regression that's tracked by PR30274. I'll try working on a fix for it.</div><div><br></div><div>Alex</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 28 June 2016 at 12:03, Richard Smith via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rsmith<br>
Date: Tue Jun 28 14:03:57 2016<br>
New Revision: 274049<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=274049&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=274049&view=rev</a><br>
Log:<br>
P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:<br>
<br>
Replace inheriting constructors implementation with new approach, voted into<br>
C++ last year as a DR against C++11.<br>
<br>
Instead of synthesizing a set of derived class constructors for each inherited<br>
base class constructor, we make the constructors of the base class visible to<br>
constructor lookup in the derived class, using the normal rules for<br>
using-declarations.<br>
<br>
For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived<br>
class that tracks the requisite additional information. We create shadow<br>
constructors (not found by name lookup) in the derived class to model the<br>
actual initialization, and have a new expression node,<br>
CXXInheritedCtorInitExpr, to model the initialization of a base class from such<br>
a constructor. (This initialization is special because it performs real perfect<br>
forwarding of arguments.)<br>
<br>
In cases where argument forwarding is not possible (for inalloca calls,<br>
variadic calls, and calls with callee parameter cleanup), the shadow inheriting<br>
constructor is not emitted and instead we directly emit the initialization code<br>
into the caller of the inherited constructor.<br>
<br>
Note that this new model is not perfectly compatible with the old model in some<br>
corner cases. In particular:<br>
 * if B inherits a private constructor from A, and C uses that constructor to<br>
   construct a B, then we previously required that A befriends B and B<br>
   befriends C, but the new rules require A to befriend C directly, and<br>
 * if a derived class has its own constructors (and so its implicit default<br>
   constructor is suppressed), it may still inherit a default constructor from<br>
   a base class<br>
<br>
Added:<br>
    cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p15.cpp<br>
    cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p18.cpp<br>
    cfe/trunk/test/CXX/special/<wbr>class.init/class.inhctor.init/<br>
    cfe/trunk/test/CXX/special/<wbr>class.init/class.inhctor.init/<wbr>p1.cpp<br>
    cfe/trunk/test/CXX/special/<wbr>class.init/class.inhctor.init/<wbr>p2.cpp<br>
Modified:<br>
    cfe/trunk/include/clang/AST/<wbr>ASTMutationListener.h<br>
    cfe/trunk/include/clang/AST/<wbr>Decl.h<br>
    cfe/trunk/include/clang/AST/<wbr>DeclCXX.h<br>
    cfe/trunk/include/clang/AST/<wbr>ExprCXX.h<br>
    cfe/trunk/include/clang/AST/<wbr>RecursiveASTVisitor.h<br>
    cfe/trunk/include/clang/Basic/<wbr>DeclNodes.td<br>
    cfe/trunk/include/clang/Basic/<wbr>DiagnosticASTKinds.td<br>
    cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td<br>
    cfe/trunk/include/clang/Basic/<wbr>StmtNodes.td<br>
    cfe/trunk/include/clang/Sema/<wbr>Overload.h<br>
    cfe/trunk/include/clang/Sema/<wbr>Sema.h<br>
    cfe/trunk/include/clang/<wbr>Serialization/ASTBitCodes.h<br>
    cfe/trunk/lib/AST/ASTDumper.<wbr>cpp<br>
    cfe/trunk/lib/AST/DeclBase.cpp<br>
    cfe/trunk/lib/AST/DeclCXX.cpp<br>
    cfe/trunk/lib/AST/Expr.cpp<br>
    cfe/trunk/lib/AST/<wbr>ExprClassification.cpp<br>
    cfe/trunk/lib/AST/<wbr>ExprConstant.cpp<br>
    cfe/trunk/lib/AST/<wbr>ItaniumMangle.cpp<br>
    cfe/trunk/lib/AST/<wbr>NestedNameSpecifier.cpp<br>
    cfe/trunk/lib/AST/StmtPrinter.<wbr>cpp<br>
    cfe/trunk/lib/AST/StmtProfile.<wbr>cpp<br>
    cfe/trunk/lib/CodeGen/CGCall.<wbr>cpp<br>
    cfe/trunk/lib/CodeGen/CGClass.<wbr>cpp<br>
    cfe/trunk/lib/CodeGen/CGDecl.<wbr>cpp<br>
    cfe/trunk/lib/CodeGen/<wbr>CGExprAgg.cpp<br>
    cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.cpp<br>
    cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.h<br>
    cfe/trunk/lib/CodeGen/<wbr>CodeGenModule.cpp<br>
    cfe/trunk/lib/CodeGen/<wbr>CodeGenTypes.h<br>
    cfe/trunk/lib/Sema/SemaAccess.<wbr>cpp<br>
    cfe/trunk/lib/Sema/<wbr>SemaDeclCXX.cpp<br>
    cfe/trunk/lib/Sema/<wbr>SemaExceptionSpec.cpp<br>
    cfe/trunk/lib/Sema/SemaExpr.<wbr>cpp<br>
    cfe/trunk/lib/Sema/<wbr>SemaExprCXX.cpp<br>
    cfe/trunk/lib/Sema/SemaInit.<wbr>cpp<br>
    cfe/trunk/lib/Sema/SemaLookup.<wbr>cpp<br>
    cfe/trunk/lib/Sema/<wbr>SemaOverload.cpp<br>
    cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp<br>
    cfe/trunk/lib/Sema/<wbr>TreeTransform.h<br>
    cfe/trunk/lib/Serialization/<wbr>ASTCommon.cpp<br>
    cfe/trunk/lib/Serialization/<wbr>ASTReaderDecl.cpp<br>
    cfe/trunk/lib/Serialization/<wbr>ASTReaderStmt.cpp<br>
    cfe/trunk/lib/Serialization/<wbr>ASTWriter.cpp<br>
    cfe/trunk/lib/Serialization/<wbr>ASTWriterDecl.cpp<br>
    cfe/trunk/lib/Serialization/<wbr>ASTWriterStmt.cpp<br>
    cfe/trunk/lib/StaticAnalyzer/<wbr>Core/ExprEngine.cpp<br>
    cfe/trunk/test/CXX/basic/<wbr>basic.lookup/basic.lookup.<wbr>qual/class.qual/p2.cpp<br>
    cfe/trunk/test/CXX/basic/<wbr>basic.types/p10.cpp<br>
    cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p4.cpp<br>
    cfe/trunk/test/CXX/drs/dr15xx.<wbr>cpp<br>
    cfe/trunk/test/CXX/drs/dr16xx.<wbr>cpp<br>
    cfe/trunk/test/CXX/drs/dr17xx.<wbr>cpp<br>
    cfe/trunk/test/CXX/drs/dr19xx.<wbr>cpp<br>
    cfe/trunk/test/CXX/except/<wbr>except.spec/p14.cpp<br>
    cfe/trunk/test/CXX/special/<wbr>class.inhctor/p1.cpp<br>
    cfe/trunk/test/CXX/special/<wbr>class.inhctor/p2.cpp<br>
    cfe/trunk/test/CXX/special/<wbr>class.inhctor/p3.cpp<br>
    cfe/trunk/test/CXX/special/<wbr>class.inhctor/p4.cpp<br>
    cfe/trunk/test/CXX/special/<wbr>class.inhctor/p7.cpp<br>
    cfe/trunk/test/CXX/special/<wbr>class.inhctor/p8.cpp<br>
    cfe/trunk/test/CodeGenCXX/<wbr>inheriting-constructor.cpp<br>
    cfe/trunk/test/PCH/cxx11-<wbr>inheriting-ctors.cpp<br>
    cfe/trunk/test/SemaCXX/<wbr>constant-expression-cxx11.cpp<br>
    cfe/trunk/test/SemaCXX/cxx11-<wbr>inheriting-ctors.cpp<br>
    cfe/trunk/tools/libclang/<wbr>CIndex.cpp<br>
    cfe/trunk/tools/libclang/<wbr>CXCursor.cpp<br>
    cfe/trunk/www/cxx_status.html<br>
<br>
Modified: cfe/trunk/include/clang/AST/<wbr>ASTMutationListener.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTMutationListener.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/AST/ASTMutationListener.<wbr>h?rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/AST/<wbr>ASTMutationListener.h (original)<br>
+++ cfe/trunk/include/clang/AST/<wbr>ASTMutationListener.h Tue Jun 28 14:03:57 2016<br>
@@ -17,6 +17,7 @@ namespace clang {<br>
   class Attr;<br>
   class ClassTemplateDecl;<br>
   class ClassTemplateSpecializationDec<wbr>l;<br>
+  class ConstructorUsingShadowDecl;<br>
   class CXXDestructorDecl;<br>
   class CXXRecordDecl;<br>
   class Decl;<br>
<br>
Modified: cfe/trunk/include/clang/AST/<wbr>Decl.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/AST/Decl.h?rev=274049&<wbr>r1=274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/AST/<wbr>Decl.h (original)<br>
+++ cfe/trunk/include/clang/AST/<wbr>Decl.h Tue Jun 28 14:03:57 2016<br>
@@ -387,6 +387,7 @@ public:<br>
   NamedDecl *getUnderlyingDecl() {<br>
     // Fast-path the common case.<br>
     if (this->getKind() != UsingShadow &&<br>
+        this->getKind() != ConstructorUsingShadow &&<br>
         this->getKind() != ObjCCompatibleAlias &&<br>
         this->getKind() != NamespaceAlias)<br>
       return this;<br>
<br>
Modified: cfe/trunk/include/clang/AST/<wbr>DeclCXX.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/AST/DeclCXX.h?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/AST/<wbr>DeclCXX.h (original)<br>
+++ cfe/trunk/include/clang/AST/<wbr>DeclCXX.h Tue Jun 28 14:03:57 2016<br>
@@ -29,6 +29,7 @@ namespace clang {<br>
<br>
 class ClassTemplateDecl;<br>
 class ClassTemplateSpecializationDec<wbr>l;<br>
+class ConstructorUsingShadowDecl;<br>
 class CXXBasePath;<br>
 class CXXBasePaths;<br>
 class CXXConstructorDecl;<br>
@@ -1298,7 +1299,7 @@ public:<br>
   }<br>
<br>
   /// \brief Determine whether this class has a using-declaration that names<br>
-  /// a base class constructor.<br>
+  /// a user-declared base class constructor.<br>
   bool hasInheritedConstructor() const {<br>
     return data().<wbr>HasInheritedConstructor;<br>
   }<br>
@@ -2153,6 +2154,23 @@ public:<br>
   friend TrailingObjects;<br>
 };<br>
<br>
+/// Description of a constructor that was inherited from a base class.<br>
+class InheritedConstructor {<br>
+  ConstructorUsingShadowDecl *Shadow;<br>
+  CXXConstructorDecl *BaseCtor;<br>
+<br>
+public:<br>
+  InheritedConstructor() : Shadow(), BaseCtor() {}<br>
+  InheritedConstructor(<wbr>ConstructorUsingShadowDecl *Shadow,<br>
+                       CXXConstructorDecl *BaseCtor)<br>
+      : Shadow(Shadow), BaseCtor(BaseCtor) {}<br>
+<br>
+  explicit operator bool() const { return Shadow; }<br>
+<br>
+  ConstructorUsingShadowDecl *getShadowDecl() const { return Shadow; }<br>
+  CXXConstructorDecl *getConstructor() const { return BaseCtor; }<br>
+};<br>
+<br>
 /// \brief Represents a C++ constructor within a class.<br>
 ///<br>
 /// For example:<br>
@@ -2163,41 +2181,51 @@ public:<br>
 ///   explicit X(int); // represented by a CXXConstructorDecl.<br>
 /// };<br>
 /// \endcode<br>
-class CXXConstructorDecl : public CXXMethodDecl {<br>
+class CXXConstructorDecl final<br>
+    : public CXXMethodDecl,<br>
+      private llvm::TrailingObjects<<wbr>CXXConstructorDecl, InheritedConstructor> {<br>
   void anchor() override;<br>
<br>
   /// \name Support for base and member initializers.<br>
   /// \{<br>
   /// \brief The arguments used to initialize the base or member.<br>
   LazyCXXCtorInitializersPtr CtorInitializers;<br>
-  unsigned NumCtorInitializers : 31;<br>
+  unsigned NumCtorInitializers : 30;<br>
   /// \}<br>
<br>
   /// \brief Whether this constructor declaration has the \c explicit keyword<br>
   /// specified.<br>
   unsigned IsExplicitSpecified : 1;<br>
<br>
+  /// \brief Whether this constructor declaration is an implicitly-declared<br>
+  /// inheriting constructor.<br>
+  unsigned IsInheritingConstructor : 1;<br>
+<br>
   CXXConstructorDecl(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc,<br>
                      const DeclarationNameInfo &NameInfo,<br>
                      QualType T, TypeSourceInfo *TInfo,<br>
                      bool isExplicitSpecified, bool isInline,<br>
-                     bool isImplicitlyDeclared, bool isConstexpr)<br>
+                     bool isImplicitlyDeclared, bool isConstexpr,<br>
+                     InheritedConstructor Inherited)<br>
     : CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,<br>
                     SC_None, isInline, isConstexpr, SourceLocation()),<br>
       CtorInitializers(nullptr), NumCtorInitializers(0),<br>
-      IsExplicitSpecified(<wbr>isExplicitSpecified) {<br>
+      IsExplicitSpecified(<wbr>isExplicitSpecified),<br>
+      IsInheritingConstructor((bool)<wbr>Inherited) {<br>
     setImplicit(<wbr>isImplicitlyDeclared);<br>
+    if (Inherited)<br>
+      *getTrailingObjects<<wbr>InheritedConstructor>() = Inherited;<br>
   }<br>
<br>
 public:<br>
-  static CXXConstructorDecl *CreateDeserialized(ASTContext &C, unsigned ID);<br>
-  static CXXConstructorDecl *Create(ASTContext &C, CXXRecordDecl *RD,<br>
-                                    SourceLocation StartLoc,<br>
-                                    const DeclarationNameInfo &NameInfo,<br>
-                                    QualType T, TypeSourceInfo *TInfo,<br>
-                                    bool isExplicit,<br>
-                                    bool isInline, bool isImplicitlyDeclared,<br>
-                                    bool isConstexpr);<br>
+  static CXXConstructorDecl *CreateDeserialized(ASTContext &C, unsigned ID,<br>
+                                                bool InheritsConstructor);<br>
+  static CXXConstructorDecl *<br>
+  Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc,<br>
+         const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo,<br>
+         bool isExplicit, bool isInline, bool isImplicitlyDeclared,<br>
+         bool isConstexpr,<br>
+         InheritedConstructor Inherited = InheritedConstructor());<br>
<br>
   /// \brief Determine whether this constructor declaration has the<br>
   /// \c explicit keyword specified.<br>
@@ -2344,11 +2372,15 @@ public:<br>
   /// an object.<br>
   bool isSpecializationCopyingObject(<wbr>) const;<br>
<br>
-  /// \brief Get the constructor that this inheriting constructor is based on.<br>
-  const CXXConstructorDecl *getInheritedConstructor() const;<br>
+  /// \brief Determine whether this is an implicit constructor synthesized to<br>
+  /// model a call to a constructor inherited from a base class.<br>
+  bool isInheritingConstructor() const { return IsInheritingConstructor; }<br>
<br>
-  /// \brief Set the constructor that this inheriting constructor is based on.<br>
-  void setInheritedConstructor(const CXXConstructorDecl *BaseCtor);<br>
+  /// \brief Get the constructor that this inheriting constructor is based on.<br>
+  InheritedConstructor getInheritedConstructor() const {<br>
+    return IsInheritingConstructor ? *getTrailingObjects<<wbr>InheritedConstructor>()<br>
+                                   : InheritedConstructor();<br>
+  }<br>
<br>
   CXXConstructorDecl *getCanonicalDecl() override {<br>
     return cast<CXXConstructorDecl>(<wbr>FunctionDecl::<wbr>getCanonicalDecl());<br>
@@ -2363,6 +2395,7 @@ public:<br>
<br>
   friend class ASTDeclReader;<br>
   friend class ASTDeclWriter;<br>
+  friend TrailingObjects;<br>
 };<br>
<br>
 /// \brief Represents a C++ destructor within a class.<br>
@@ -2807,18 +2840,6 @@ class UsingShadowDecl : public NamedDecl<br>
   NamedDecl *UsingOrNextShadow;<br>
   friend class UsingDecl;<br>
<br>
-  UsingShadowDecl(ASTContext &C, DeclContext *DC, SourceLocation Loc,<br>
-                  UsingDecl *Using, NamedDecl *Target)<br>
-    : NamedDecl(UsingShadow, DC, Loc, DeclarationName()),<br>
-      redeclarable_base(C), Underlying(Target),<br>
-      UsingOrNextShadow(reinterpret_<wbr>cast<NamedDecl *>(Using)) {<br>
-    if (Target) {<br>
-      setDeclName(Target-><wbr>getDeclName());<br>
-      IdentifierNamespace = Target-><wbr>getIdentifierNamespace();<br>
-    }<br>
-    setImplicit();<br>
-  }<br>
-<br>
   typedef Redeclarable<UsingShadowDecl> redeclarable_base;<br>
   UsingShadowDecl *getNextRedeclarationImpl() override {<br>
     return getNextRedeclaration();<br>
@@ -2830,11 +2851,16 @@ class UsingShadowDecl : public NamedDecl<br>
     return getMostRecentDecl();<br>
   }<br>
<br>
+protected:<br>
+  UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC, SourceLocation Loc,<br>
+                  UsingDecl *Using, NamedDecl *Target);<br>
+  UsingShadowDecl(Kind K, ASTContext &C, EmptyShell);<br>
+<br>
 public:<br>
   static UsingShadowDecl *Create(ASTContext &C, DeclContext *DC,<br>
                                  SourceLocation Loc, UsingDecl *Using,<br>
                                  NamedDecl *Target) {<br>
-    return new (C, DC) UsingShadowDecl(C, DC, Loc, Using, Target);<br>
+    return new (C, DC) UsingShadowDecl(UsingShadow, C, DC, Loc, Using, Target);<br>
   }<br>
<br>
   static UsingShadowDecl *CreateDeserialized(ASTContext &C, unsigned ID);<br>
@@ -2846,6 +2872,7 @@ public:<br>
   using redeclarable_base::redecls;<br>
   using redeclarable_base::<wbr>getPreviousDecl;<br>
   using redeclarable_base::<wbr>getMostRecentDecl;<br>
+  using redeclarable_base::<wbr>isFirstDecl;<br>
<br>
   UsingShadowDecl *getCanonicalDecl() override {<br>
     return getFirstDecl();<br>
@@ -2876,7 +2903,125 @@ public:<br>
   }<br>
<br>
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }<br>
-  static bool classofKind(Kind K) { return K == Decl::UsingShadow; }<br>
+  static bool classofKind(Kind K) {<br>
+    return K == Decl::UsingShadow || K == Decl::ConstructorUsingShadow;<br>
+  }<br>
+<br>
+  friend class ASTDeclReader;<br>
+  friend class ASTDeclWriter;<br>
+};<br>
+<br>
+/// \brief Represents a shadow constructor declaration introduced into a<br>
+/// class by a C++11 using-declaration that names a constructor.<br>
+///<br>
+/// For example:<br>
+/// \code<br>
+/// struct Base { Base(int); };<br>
+/// struct Derived {<br>
+///    using Base::Base; // creates a UsingDecl and a ConstructorUsingShadowDecl<br>
+/// };<br>
+/// \endcode<br>
+class ConstructorUsingShadowDecl final : public UsingShadowDecl {<br>
+  void anchor() override;<br>
+<br>
+  /// \brief If this constructor using declaration inherted the constructor<br>
+  /// from an indirect base class, this is the ConstructorUsingShadowDecl<br>
+  /// in the named direct base class from which the declaration was inherited.<br>
+  ConstructorUsingShadowDecl *NominatedBaseClassShadowDecl;<br>
+<br>
+  /// \brief If this constructor using declaration inherted the constructor<br>
+  /// from an indirect base class, this is the ConstructorUsingShadowDecl<br>
+  /// that will be used to construct the unique direct or virtual base class<br>
+  /// that receives the constructor arguments.<br>
+  ConstructorUsingShadowDecl *<wbr>ConstructedBaseClassShadowDecl<wbr>;<br>
+<br>
+  /// \brief \c true if the constructor ultimately named by this using shadow<br>
+  /// declaration is within a virtual base class subobject of the class that<br>
+  /// contains this declaration.<br>
+  unsigned IsVirtual : 1;<br>
+<br>
+  ConstructorUsingShadowDecl(<wbr>ASTContext &C, DeclContext *DC, SourceLocation Loc,<br>
+                             UsingDecl *Using, NamedDecl *Target,<br>
+                             bool TargetInVirtualBase)<br>
+      : UsingShadowDecl(<wbr>ConstructorUsingShadow, C, DC, Loc, Using,<br>
+                        Target->getUnderlyingDecl()),<br>
+        NominatedBaseClassShadowDecl(<br>
+            dyn_cast<<wbr>ConstructorUsingShadowDecl>(<wbr>Target)),<br>
+        ConstructedBaseClassShadowDecl<wbr>(NominatedBaseClassShadowDecl)<wbr>,<br>
+        IsVirtual(TargetInVirtualBase) {<br>
+    // If we found a constructor for a non-virtual base class, but it chains to<br>
+    // a constructor for a virtual base, we should directly call the virtual<br>
+    // base constructor instead.<br>
+    // FIXME: This logic belongs in Sema.<br>
+    if (!TargetInVirtualBase && NominatedBaseClassShadowDecl &&<br>
+        NominatedBaseClassShadowDecl-><wbr>constructsVirtualBase()) {<br>
+      ConstructedBaseClassShadowDecl =<br>
+          NominatedBaseClassShadowDecl-><wbr>ConstructedBaseClassShadowDecl<wbr>;<br>
+      IsVirtual = true;<br>
+    }<br>
+  }<br>
+  ConstructorUsingShadowDecl(<wbr>ASTContext &C, EmptyShell Empty)<br>
+      : UsingShadowDecl(<wbr>ConstructorUsingShadow, C, Empty) {}<br>
+<br>
+public:<br>
+  static ConstructorUsingShadowDecl *Create(ASTContext &C, DeclContext *DC,<br>
+                                            SourceLocation Loc,<br>
+                                            UsingDecl *Using, NamedDecl *Target,<br>
+                                            bool IsVirtual);<br>
+  static ConstructorUsingShadowDecl *CreateDeserialized(ASTContext &C,<br>
+                                                        unsigned ID);<br>
+<br>
+  /// Returns the parent of this using shadow declaration, which<br>
+  /// is the class in which this is declared.<br>
+  //@{<br>
+  const CXXRecordDecl *getParent() const {<br>
+    return cast<CXXRecordDecl>(<wbr>getDeclContext());<br>
+  }<br>
+  CXXRecordDecl *getParent() {<br>
+    return cast<CXXRecordDecl>(<wbr>getDeclContext());<br>
+  }<br>
+  //@}<br>
+<br>
+  /// \brief Get the inheriting constructor declaration for the direct base<br>
+  /// class from which this using shadow declaration was inherited, if there is<br>
+  /// one. This can be different for each redeclaration of the same shadow decl.<br>
+  ConstructorUsingShadowDecl *<wbr>getNominatedBaseClassShadowDec<wbr>l() const {<br>
+    return NominatedBaseClassShadowDecl;<br>
+  }<br>
+<br>
+  /// \brief Get the inheriting constructor declaration for the base class<br>
+  /// for which we don't have an explicit initializer, if there is one.<br>
+  ConstructorUsingShadowDecl *<wbr>getConstructedBaseClassShadowD<wbr>ecl() const {<br>
+    return ConstructedBaseClassShadowDecl<wbr>;<br>
+  }<br>
+<br>
+  /// \brief Get the base class that was named in the using declaration. This<br>
+  /// can be different for each redeclaration of this same shadow decl.<br>
+  CXXRecordDecl *getNominatedBaseClass() const;<br>
+<br>
+  /// \brief Get the base class whose constructor or constructor shadow<br>
+  /// declaration is passed the constructor arguments.<br>
+  CXXRecordDecl *getConstructedBaseClass() const {<br>
+    return cast<CXXRecordDecl>((<wbr>ConstructedBaseClassShadowDecl<br>
+                                    ? ConstructedBaseClassShadowDecl<br>
+                                    : getTargetDecl())<br>
+                                   ->getDeclContext());<br>
+  }<br>
+<br>
+  /// \brief Returns \c true if the constructed base class is a virtual base<br>
+  /// class subobject of this declaration's class.<br>
+  bool constructsVirtualBase() const {<br>
+    return IsVirtual;<br>
+  }<br>
+<br>
+  /// \brief Get the constructor or constructor template in the derived class<br>
+  /// correspnding to this using shadow declaration, if it has been implicitly<br>
+  /// declared already.<br>
+  CXXConstructorDecl *getConstructor() const;<br>
+  void setConstructor(NamedDecl *Ctor);<br>
+<br>
+  static bool classof(const Decl *D) { return classofKind(D->getKind()); }<br>
+  static bool classofKind(Kind K) { return K == ConstructorUsingShadow; }<br>
<br>
   friend class ASTDeclReader;<br>
   friend class ASTDeclWriter;<br>
<br>
Modified: cfe/trunk/include/clang/AST/<wbr>ExprCXX.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/AST/ExprCXX.h?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/AST/<wbr>ExprCXX.h (original)<br>
+++ cfe/trunk/include/clang/AST/<wbr>ExprCXX.h Tue Jun 28 14:03:57 2016<br>
@@ -1318,6 +1318,73 @@ public:<br>
   friend class ASTStmtReader;<br>
 };<br>
<br>
+/// \brief Represents a call to an inherited base class constructor from an<br>
+/// inheriting constructor. This call implicitly forwards the arguments from<br>
+/// the enclosing context (an inheriting constructor) to the specified inherited<br>
+/// base class constructor.<br>
+class CXXInheritedCtorInitExpr : public Expr {<br>
+private:<br>
+  CXXConstructorDecl *Constructor;<br>
+<br>
+  /// The location of the using declaration.<br>
+  SourceLocation Loc;<br>
+<br>
+  /// Whether this is the construction of a virtual base.<br>
+  unsigned ConstructsVirtualBase : 1;<br>
+<br>
+  /// Whether the constructor is inherited from a virtual base class of the<br>
+  /// class that we construct.<br>
+  unsigned InheritedFromVirtualBase : 1;<br>
+<br>
+public:<br>
+  /// \brief Construct a C++ inheriting construction expression.<br>
+  CXXInheritedCtorInitExpr(<wbr>SourceLocation Loc, QualType T,<br>
+                           CXXConstructorDecl *Ctor, bool ConstructsVirtualBase,<br>
+                           bool InheritedFromVirtualBase)<br>
+      : Expr(<wbr>CXXInheritedCtorInitExprClass, T, VK_RValue, OK_Ordinary, false,<br>
+             false, false, false),<br>
+        Constructor(Ctor), Loc(Loc),<br>
+        ConstructsVirtualBase(<wbr>ConstructsVirtualBase),<br>
+        InheritedFromVirtualBase(<wbr>InheritedFromVirtualBase) {<br>
+    assert(!T->isDependentType());<br>
+  }<br>
+<br>
+  /// \brief Construct an empty C++ inheriting construction expression.<br>
+  explicit CXXInheritedCtorInitExpr(<wbr>EmptyShell Empty)<br>
+      : Expr(<wbr>CXXInheritedCtorInitExprClass, Empty), Constructor(nullptr),<br>
+        ConstructsVirtualBase(false), InheritedFromVirtualBase(<wbr>false) {}<br>
+<br>
+  /// \brief Get the constructor that this expression will call.<br>
+  CXXConstructorDecl *getConstructor() const { return Constructor; }<br>
+<br>
+  /// \brief Determine whether this constructor is actually constructing<br>
+  /// a base class (rather than a complete object).<br>
+  bool constructsVBase() const { return ConstructsVirtualBase; }<br>
+  CXXConstructExpr::<wbr>ConstructionKind getConstructionKind() const {<br>
+    return ConstructsVirtualBase ? CXXConstructExpr::CK_<wbr>VirtualBase<br>
+                                 : CXXConstructExpr::CK_<wbr>NonVirtualBase;<br>
+  }<br>
+<br>
+  /// \brief Determine whether the inherited constructor is inherited from a<br>
+  /// virtual base of the object we construct. If so, we are not responsible<br>
+  /// for calling the inherited constructor (the complete object constructor<br>
+  /// does that), and so we don't need to pass any arguments.<br>
+  bool inheritedFromVBase() const { return InheritedFromVirtualBase; }<br>
+<br>
+  SourceLocation getLocation() const LLVM_READONLY { return Loc; }<br>
+  SourceLocation getLocStart() const LLVM_READONLY { return Loc; }<br>
+  SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }<br>
+<br>
+  static bool classof(const Stmt *T) {<br>
+    return T->getStmtClass() == CXXInheritedCtorInitExprClass;<br>
+  }<br>
+  child_range children() {<br>
+    return child_range(child_iterator(), child_iterator());<br>
+  }<br>
+<br>
+  friend class ASTStmtReader;<br>
+};<br>
+<br>
 /// \brief Represents an explicit C++ type conversion that uses "functional"<br>
 /// notation (C++ [expr.type.conv]).<br>
 ///<br>
<br>
Modified: cfe/trunk/include/clang/AST/<wbr>RecursiveASTVisitor.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/AST/RecursiveASTVisitor.<wbr>h?rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/AST/<wbr>RecursiveASTVisitor.h (original)<br>
+++ cfe/trunk/include/clang/AST/<wbr>RecursiveASTVisitor.h Tue Jun 28 14:03:57 2016<br>
@@ -1466,6 +1466,8 @@ DEF_TRAVERSE_DECL(<wbr>UsingDirectiveDecl, {<br>
<br>
 DEF_TRAVERSE_DECL(<wbr>UsingShadowDecl, {})<br>
<br>
+DEF_TRAVERSE_DECL(<wbr>ConstructorUsingShadowDecl, {})<br>
+<br>
 DEF_TRAVERSE_DECL(<wbr>OMPThreadPrivateDecl, {<br>
   for (auto *I : D->varlists()) {<br>
     TRY_TO(TraverseStmt(I));<br>
@@ -2266,6 +2268,7 @@ DEF_TRAVERSE_STMT(<wbr>CXXDefaultArgExpr, {})<br>
 DEF_TRAVERSE_STMT(<wbr>CXXDefaultInitExpr, {})<br>
 DEF_TRAVERSE_STMT(<wbr>CXXDeleteExpr, {})<br>
 DEF_TRAVERSE_STMT(<wbr>ExprWithCleanups, {})<br>
+DEF_TRAVERSE_STMT(<wbr>CXXInheritedCtorInitExpr, {})<br>
 DEF_TRAVERSE_STMT(<wbr>CXXNullPtrLiteralExpr, {})<br>
 DEF_TRAVERSE_STMT(<wbr>CXXStdInitializerListExpr, {})<br>
 DEF_TRAVERSE_STMT(<wbr>CXXPseudoDestructorExpr, {<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>DeclNodes.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DeclNodes.td?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Basic/DeclNodes.td?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>DeclNodes.td (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>DeclNodes.td Tue Jun 28 14:03:57 2016<br>
@@ -66,6 +66,7 @@ def Named : Decl<1>;<br>
     def BuiltinTemplate : DDecl<Template>;<br>
   def Using : DDecl<Named>;<br>
   def UsingShadow : DDecl<Named>;<br>
+    def ConstructorUsingShadow : DDecl<UsingShadow>;<br>
   def ObjCMethod : DDecl<Named>, DeclContext;<br>
   def ObjCContainer : DDecl<Named, 1>, DeclContext;<br>
     def ObjCCategory : DDecl<ObjCContainer>;<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>DiagnosticASTKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Basic/<wbr>DiagnosticASTKinds.td?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>DiagnosticASTKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>DiagnosticASTKinds.td Tue Jun 28 14:03:57 2016<br>
@@ -26,6 +26,9 @@ def note_constexpr_lshift_discards : Not<br>
 def note_constexpr_invalid_<wbr>function : Note<<br>
   "%select{non-constexpr|<wbr>undefined}0 %select{function|constructor}1 %2 cannot "<br>
   "be used in a constant expression">;<br>
+def note_constexpr_invalid_inhctor : Note<<br>
+  "constructor inherited from base class %0 cannot be used in a "<br>
+  "constant expression; derived class cannot be implicitly initialized">;<br>
 def note_constexpr_no_return : Note<<br>
   "control reached end of constexpr function">;<br>
 def note_constexpr_virtual_call : Note<<br>
@@ -141,6 +144,8 @@ def note_constexpr_calls_<wbr>suppressed : No<br>
   "(skipping %0 call%s0 in backtrace; use -fconstexpr-backtrace-limit=0 to "<br>
   "see all)">;<br>
 def note_constexpr_call_here : Note<"in call to '%0'">;<br>
+def note_constexpr_inherited_ctor_<wbr>call_here : Note<<br>
+  "in implicit initialization for inherited constructor of %0">;<br>
 def note_constexpr_baa_<wbr>insufficient_alignment : Note<<br>
   "%select{alignment of|offset of the aligned pointer from}0 the base pointee "<br>
   "object (%1 %plural{1:byte|:bytes}1) is %select{less than|not a multiple of}0 the "<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Basic/<wbr>DiagnosticSemaKinds.td?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td Tue Jun 28 14:03:57 2016<br>
@@ -381,22 +381,12 @@ def err_using_decl_nested_name_<wbr>specifier<br>
   "using declaration refers into '%0', which is not a base class of %1">;<br>
 def err_using_decl_constructor_<wbr>not_in_direct_base : Error<<br>
   "%0 is not a direct base of %1, cannot inherit constructors">;<br>
-def err_using_decl_constructor_<wbr>conflict : Error<<br>
-  "cannot inherit constructor, already inherited constructor with "<br>
-  "the same signature">;<br>
-def note_using_decl_constructor_<wbr>conflict_current_ctor : Note<<br>
-  "conflicting constructor">;<br>
-def note_using_decl_constructor_<wbr>conflict_previous_ctor : Note<<br>
-  "previous constructor">;<br>
-def note_using_decl_constructor_<wbr>conflict_previous_using : Note<<br>
-  "previously inherited here">;<br>
-def warn_using_decl_constructor_<wbr>ellipsis : Warning<<br>
-  "inheriting constructor does not inherit ellipsis">,<br>
-  InGroup<DiagGroup<"inherited-<wbr>variadic-ctor">>;<br>
-def note_using_decl_constructor_<wbr>ellipsis : Note<<br>
-  "constructor declared with ellipsis here">;<br>
 def err_using_decl_can_not_refer_<wbr>to_class_member : Error<<br>
   "using declaration cannot refer to class member">;<br>
+def err_ambiguous_inherited_<wbr>constructor : Error<<br>
+  "constructor of %0 inherited from multiple base class subobjects">;<br>
+def note_ambiguous_inherited_<wbr>constructor_using : Note<<br>
+  "inherited from base class %0 here">;<br>
 def note_using_decl_class_member_<wbr>workaround : Note<<br>
   "use %select{an alias declaration|a typedef declaration|a reference|"<br>
   "a const variable|a constexpr variable}0 instead">;<br>
@@ -415,7 +405,7 @@ def err_using_decl_template_id : Error<<br>
   "using declaration cannot refer to a template specialization">;<br>
 def note_using_decl_target : Note<"target of using declaration">;<br>
 def note_using_decl_conflict : Note<"conflicting declaration">;<br>
-def err_using_decl_redeclaration : Error<"redeclaration of using decl">;<br>
+def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;<br>
 def err_using_decl_conflict : Error<<br>
   "target of using declaration conflicts with declaration already in scope">;<br>
 def err_using_decl_conflict_<wbr>reverse : Error<<br>
@@ -1436,11 +1426,13 @@ def note_member_synthesized_at : Note<<br>
   "assignment operator|move assignment operator|destructor}0 for %1 first "<br>
   "required here">;<br>
 def note_inhctor_synthesized_at : Note<<br>
-  "inheriting constructor for %0 first required here">;<br>
+  "inherited constructor for %0 first required here">;<br>
 def err_missing_default_ctor : Error<<br>
-  "%select{|implicit default |inheriting }0constructor for %1 must explicitly "<br>
-  "initialize the %select{base class|member}2 %3 which does not have a default "<br>
-  "constructor">;<br>
+  "%select{constructor for %1 must explicitly initialize the|"<br>
+  "implicit default constructor for %1 must explicitly initialize the|"<br>
+  "cannot use constructor inherited from base class %4;}0 "<br>
+  "%select{base class|member}2 %3 %select{which|which|of %1}0 "<br>
+  "does not have a default constructor">;<br>
 def note_due_to_dllexported_class : Note<<br>
   "due to '%0' being dllexported%select{|; try compiling in C++11 mode}1">;<br>
<br>
@@ -3111,7 +3103,9 @@ def err_uninitialized_member_for_<wbr>assign<br>
   "non-static %select{reference|const}1 member %2 cannot use copy "<br>
   "assignment operator">;<br>
 def err_uninitialized_member_in_<wbr>ctor : Error<<br>
-  "%select{|implicit default |inheriting }0constructor for %1 must explicitly "<br>
+  "%select{constructor for %1|"<br>
+  "implicit default constructor for %1|"<br>
+  "cannot use constructor inherited from %1:}0 must explicitly "<br>
   "initialize the %select{reference|const}2 member %3">;<br>
 def err_default_arg_makes_ctor_<wbr>special : Error<<br>
   "addition of default argument on redeclaration makes this constructor a "<br>
@@ -3160,7 +3154,8 @@ def note_ovl_candidate : Note<"candidate<br>
     "is the implicit move constructor|"<br>
     "is the implicit copy assignment operator|"<br>
     "is the implicit move assignment operator|"<br>
-    "is an inherited constructor}0%1"<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1"<br>
     "%select{| has different class%diff{ (expected $ but has $)|}3,4"<br>
     "| has different number of parameters (expected %3 but has %4)"<br>
     "| has type mismatch at %ordinal3 parameter"<br>
@@ -3172,7 +3167,8 @@ def note_ovl_candidate : Note<"candidate<br>
     "%select{none|const|restrict|<wbr>const and restrict|volatile|const and volatile"<br>
     "|volatile and restrict|const, volatile, and restrict}4)}2">;<br>
<br>
-def note_ovl_candidate_inherited_<wbr>constructor : Note<"inherited from here">;<br>
+def note_ovl_candidate_inherited_<wbr>constructor : Note<<br>
+    "constructor from base class %0 inherited here">;<br>
 def note_ovl_candidate_illegal_<wbr>constructor : Note<<br>
     "candidate %select{constructor|template}0 ignored: "<br>
     "instantiation %select{takes|would take}0 its own class type by value">;<br>
@@ -3232,7 +3228,8 @@ def note_ovl_candidate_arity : Note<"can<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0 %select{|template }1"<br>
+    "inherited constructor|"<br>
+    "inherited constructor}0 %select{|template }1"<br>
     "not viable: requires%select{ at least| at most|}2 %3 argument%s3, but %4 "<br>
     "%plural{1:was|:were}4 provided">;<br>
<br>
@@ -3243,7 +3240,8 @@ def note_ovl_candidate_arity_one : Note<<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0 %select{|template }1not viable: "<br>
+    "inherited constructor|"<br>
+    "inherited constructor}0 %select{|template }1not viable: "<br>
     "%select{requires at least|allows at most single|requires single}2 "<br>
     "argument %3, but %plural{0:no|:%4}4 arguments were provided">;<br>
<br>
@@ -3255,7 +3253,8 @@ def note_ovl_candidate_deleted : Note<<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1 has been "<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1 has been "<br>
     "%select{explicitly made unavailable|explicitly deleted|"<br>
     "implicitly deleted}2">;<br>
<br>
@@ -3272,7 +3271,8 @@ def note_ovl_candidate_bad_conv_<wbr>incomple<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1 "<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1 "<br>
     "not viable: cannot convert argument of incomplete type "<br>
     "%diff{$ to $|to parameter type}2,3 for "<br>
     "%select{%ordinal5 argument|object argument}4"<br>
@@ -3288,7 +3288,8 @@ def note_ovl_candidate_bad_list_<wbr>argument<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1 "<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1 "<br>
     "not viable: cannot convert initializer list argument to %3">;<br>
 def note_ovl_candidate_bad_<wbr>overload : Note<"candidate "<br>
     "%select{function|function|<wbr>constructor|"<br>
@@ -3298,7 +3299,8 @@ def note_ovl_candidate_bad_<wbr>overload : No<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1"<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1"<br>
     " not viable: no overload of %3 matching %2 for %ordinal4 argument">;<br>
 def note_ovl_candidate_bad_conv : Note<"candidate "<br>
     "%select{function|function|<wbr>constructor|"<br>
@@ -3308,7 +3310,8 @@ def note_ovl_candidate_bad_conv : Note<"<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1"<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1"<br>
     " not viable: no known conversion "<br>
     "%diff{from $ to $|from argument type to parameter type}2,3 for "<br>
     "%select{%ordinal5 argument|object argument}4"<br>
@@ -3324,7 +3327,8 @@ def note_ovl_candidate_bad_arc_<wbr>conv : No<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1"<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1"<br>
     " not viable: cannot implicitly convert argument "<br>
     "%diff{of type $ to $|type to parameter type}2,3 for "<br>
     "%select{%ordinal5 argument|object argument}4 under ARC">;<br>
@@ -3336,7 +3340,8 @@ def note_ovl_candidate_bad_lvalue : Note<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1"<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1"<br>
     " not viable: expects an l-value for "<br>
     "%select{%ordinal3 argument|object argument}2">;<br>
 def note_ovl_candidate_bad_<wbr>addrspace : Note<"candidate "<br>
@@ -3347,7 +3352,8 @@ def note_ovl_candidate_bad_<wbr>addrspace : N<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1 not viable: "<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1 not viable: "<br>
     "%select{%ordinal6|'this'}5 argument (%2) is in "<br>
     "address space %3, but parameter must be in address space %4">;<br>
 def note_ovl_candidate_bad_gc : Note<"candidate "<br>
@@ -3358,7 +3364,8 @@ def note_ovl_candidate_bad_gc : Note<"ca<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1 not viable: "<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1 not viable: "<br>
     "%select{%ordinal6|'this'}5 argument (%2) has %select{no|__weak|__strong}3 "<br>
     "ownership, but parameter has %select{no|__weak|__strong}4 ownership">;<br>
 def note_ovl_candidate_bad_<wbr>ownership : Note<"candidate "<br>
@@ -3369,7 +3376,8 @@ def note_ovl_candidate_bad_<wbr>ownership : N<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1 not viable: "<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1 not viable: "<br>
     "%select{%ordinal6|'this'}5 argument (%2) has "<br>
     "%select{no|__unsafe_<wbr>unretained|__strong|__weak|__<wbr>autoreleasing}3 ownership,"<br>
     " but parameter has %select{no|__unsafe_<wbr>unretained|__strong|__weak|"<br>
@@ -3377,7 +3385,7 @@ def note_ovl_candidate_bad_<wbr>ownership : N<br>
 def note_ovl_candidate_bad_cvr_<wbr>this : Note<"candidate "<br>
     "%select{|function|||function|<wbr>||||"<br>
     "function (the implicit copy assignment operator)|"<br>
-    "function (the implicit move assignment operator)|}0 not viable: "<br>
+    "function (the implicit move assignment operator)||}0 not viable: "<br>
     "'this' argument has type %2, but method is not marked "<br>
     "%select{const|restrict|const or restrict|volatile|const or volatile|"<br>
     "volatile or restrict|const, volatile, or restrict}3">;<br>
@@ -3389,7 +3397,8 @@ def note_ovl_candidate_bad_cvr : Note<"c<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1 not viable: "<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1 not viable: "<br>
     "%ordinal4 argument (%2) would lose "<br>
     "%select{const|restrict|const and restrict|volatile|const and volatile|"<br>
     "volatile and restrict|const, volatile, and restrict}3 qualifier"<br>
@@ -3402,7 +3411,8 @@ def note_ovl_candidate_bad_<wbr>unaligned : N<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1 not viable: "<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1 not viable: "<br>
     "%ordinal4 argument (%2) would lose __unaligned qualifier">;<br>
 def note_ovl_candidate_bad_base_<wbr>to_derived_conv : Note<"candidate "<br>
     "%select{function|function|<wbr>constructor|"<br>
@@ -3412,20 +3422,23 @@ def note_ovl_candidate_bad_base_<wbr>to_deriv<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0%1"<br>
-    " not viable: cannot %select{convert from|convert from|bind}2 "<br>
+    "inherited constructor|"<br>
+    "inherited constructor }0%1 not viable: "<br>
+    "cannot %select{convert from|convert from|bind}2 "<br>
     "%select{base class pointer|superclass|base class object of type}2 %3 to "<br>
     "%select{derived class pointer|subclass|derived class reference}2 %4 for "<br>
     "%ordinal5 argument">;<br>
 def note_ovl_candidate_bad_target : Note<<br>
     "candidate %select{function|function|<wbr>constructor|"<br>
-    "function |function |constructor |"<br>
+    "function|function|<wbr>constructor|"<br>
     "constructor (the implicit default constructor)|"<br>
     "constructor (the implicit copy constructor)|"<br>
     "constructor (the implicit move constructor)|"<br>
     "function (the implicit copy assignment operator)|"<br>
     "function (the implicit move assignment operator)|"<br>
-    "constructor (inherited)}0 not viable: call to "<br>
+    "inherited constructor|"<br>
+    "inherited constructor}0 not viable: "<br>
+    "call to "<br>
     "%select{__device__|__global__<wbr>|__host__|__host__ __device__|invalid}1 function from"<br>
     " %select{__device__|__global__|<wbr>__host__|__host__ __device__|invalid}2 function">;<br>
 def note_implicit_member_target_<wbr>infer_collision : Note<<br>
@@ -4237,8 +4250,6 @@ def note_implicitly_deleted : Note<<br>
   "explicitly defaulted function was implicitly deleted here">;<br>
 def note_inherited_deleted_here : Note<<br>
   "deleted constructor was inherited here">;<br>
-def note_cannot_inherit : Note<<br>
-  "constructor cannot be inherited">;<br>
 def warn_not_enough_argument : Warning<<br>
   "not enough variable arguments in %0 declaration to fit a sentinel">,<br>
   InGroup<Sentinel>;<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>StmtNodes.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Basic/StmtNodes.td?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>StmtNodes.td (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>StmtNodes.td Tue Jun 28 14:03:57 2016<br>
@@ -126,6 +126,7 @@ def ArrayTypeTraitExpr : DStmt<Expr>;<br>
 def ExpressionTraitExpr : DStmt<Expr>;<br>
 def DependentScopeDeclRefExpr : DStmt<Expr>;<br>
 def CXXConstructExpr : DStmt<Expr>;<br>
+def CXXInheritedCtorInitExpr : DStmt<Expr>;<br>
 def CXXBindTemporaryExpr : DStmt<Expr>;<br>
 def ExprWithCleanups : DStmt<Expr>;<br>
 def CXXTemporaryObjectExpr : DStmt<CXXConstructExpr>;<br>
<br>
Modified: cfe/trunk/include/clang/Sema/<wbr>Overload.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Overload.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Sema/Overload.h?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Sema/<wbr>Overload.h (original)<br>
+++ cfe/trunk/include/clang/Sema/<wbr>Overload.h Tue Jun 28 14:03:57 2016<br>
@@ -803,6 +803,7 @@ namespace clang {<br>
     DeclAccessPair FoundDecl;<br>
     CXXConstructorDecl *Constructor;<br>
     FunctionTemplateDecl *ConstructorTmpl;<br>
+    explicit operator bool() const { return Constructor; }<br>
   };<br>
   // FIXME: Add an AddOverloadCandidate / AddTemplateOverloadCandidate overload<br>
   // that takes one of these.<br>
@@ -818,7 +819,7 @@ namespace clang {<br>
     Info.ConstructorTmpl = dyn_cast<FunctionTemplateDecl><wbr>(D);<br>
     if (Info.ConstructorTmpl)<br>
       D = Info.ConstructorTmpl-><wbr>getTemplatedDecl();<br>
-    Info.Constructor = cast<CXXConstructorDecl>(D);<br>
+    Info.Constructor = dyn_cast<CXXConstructorDecl>(<wbr>D);<br>
     return Info;<br>
   }<br>
 } // end namespace clang<br>
<br>
Modified: cfe/trunk/include/clang/Sema/<wbr>Sema.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Sema/Sema.h?rev=274049&<wbr>r1=274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Sema/<wbr>Sema.h (original)<br>
+++ cfe/trunk/include/clang/Sema/<wbr>Sema.h Tue Jun 28 14:03:57 2016<br>
@@ -4256,6 +4256,13 @@ public:<br>
<br>
   bool CheckInheritingConstructorUsin<wbr>gDecl(UsingDecl *UD);<br>
<br>
+  /// Given a derived-class using shadow declaration for a constructor and the<br>
+  /// correspnding base class constructor, find or create the implicit<br>
+  /// synthesized derived class constructor to use for this initialization.<br>
+  CXXConstructorDecl *<br>
+  findInheritingConstructor(<wbr>SourceLocation Loc, CXXConstructorDecl *BaseCtor,<br>
+                            ConstructorUsingShadowDecl *DerivedShadow);<br>
+<br>
   Decl *ActOnUsingDeclaration(Scope *CurScope,<br>
                               AccessSpecifier AS,<br>
                               bool HasUsingKeyword,<br>
@@ -4422,7 +4429,8 @@ public:<br>
   /// \brief Determine what sort of exception specification an inheriting<br>
   /// constructor of a class will have.<br>
   ImplicitExceptionSpecification<br>
-  ComputeInheritingCtorException<wbr>Spec(CXXConstructorDecl *CD);<br>
+  ComputeInheritingCtorException<wbr>Spec(SourceLocation Loc,<br>
+                                     CXXConstructorDecl *CD);<br>
<br>
   /// \brief Evaluate the implicit exception specification for a defaulted<br>
   /// special member function.<br>
@@ -4491,12 +4499,6 @@ public:<br>
   void AdjustDestructorExceptionSpec(<wbr>CXXRecordDecl *ClassDecl,<br>
                                      CXXDestructorDecl *Destructor);<br>
<br>
-  /// \brief Declare all inheriting constructors for the given class.<br>
-  ///<br>
-  /// \param ClassDecl The class declaration into which the inheriting<br>
-  /// constructors will be added.<br>
-  void DeclareInheritingConstructors(<wbr>CXXRecordDecl *ClassDecl);<br>
-<br>
   /// \brief Define the specified inheriting constructor.<br>
   void DefineInheritingConstructor(<wbr>SourceLocation UseLoc,<br>
                                    CXXConstructorDecl *Constructor);<br>
@@ -5562,13 +5564,13 @@ public:<br>
                                      bool Diagnose = true);<br>
   AccessResult CheckConstructorAccess(<wbr>SourceLocation Loc,<br>
                                       CXXConstructorDecl *D,<br>
+                                      DeclAccessPair FoundDecl,<br>
                                       const InitializedEntity &Entity,<br>
-                                      AccessSpecifier Access,<br>
                                       bool IsCopyBindingRefToTemp = false);<br>
   AccessResult CheckConstructorAccess(<wbr>SourceLocation Loc,<br>
                                       CXXConstructorDecl *D,<br>
+                                      DeclAccessPair FoundDecl,<br>
                                       const InitializedEntity &Entity,<br>
-                                      AccessSpecifier Access,<br>
                                       const PartialDiagnostic &PDiag);<br>
   AccessResult CheckDestructorAccess(<wbr>SourceLocation Loc,<br>
                                      CXXDestructorDecl *Dtor,<br>
<br>
Modified: cfe/trunk/include/clang/<wbr>Serialization/ASTBitCodes.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Serialization/<wbr>ASTBitCodes.h?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/<wbr>Serialization/ASTBitCodes.h (original)<br>
+++ cfe/trunk/include/clang/<wbr>Serialization/ASTBitCodes.h Tue Jun 28 14:03:57 2016<br>
@@ -1083,6 +1083,8 @@ namespace clang {<br>
       DECL_USING,<br>
       /// \brief A UsingShadowDecl record.<br>
       DECL_USING_SHADOW,<br>
+      /// \brief A ConstructorUsingShadowDecl record.<br>
+      DECL_CONSTRUCTOR_USING_SHADOW,<br>
       /// \brief A UsingDirecitveDecl record.<br>
       DECL_USING_DIRECTIVE,<br>
       /// \brief An UnresolvedUsingValueDecl record.<br>
@@ -1097,6 +1099,8 @@ namespace clang {<br>
       DECL_CXX_METHOD,<br>
       /// \brief A CXXConstructorDecl record.<br>
       DECL_CXX_CONSTRUCTOR,<br>
+      /// \brief A CXXConstructorDecl record for an inherited constructor.<br>
+      DECL_CXX_INHERITED_<wbr>CONSTRUCTOR,<br>
       /// \brief A CXXDestructorDecl record.<br>
       DECL_CXX_DESTRUCTOR,<br>
       /// \brief A CXXConversionDecl record.<br>
@@ -1360,6 +1364,8 @@ namespace clang {<br>
       EXPR_CXX_MEMBER_CALL,<br>
       /// \brief A CXXConstructExpr record.<br>
       EXPR_CXX_CONSTRUCT,<br>
+      /// \brief A CXXInheritedCtorInitExpr record.<br>
+      EXPR_CXX_INHERITED_CTOR_INIT,<br>
       /// \brief A CXXTemporaryObjectExpr record.<br>
       EXPR_CXX_TEMPORARY_OBJECT,<br>
       /// \brief A CXXStaticCastExpr record.<br>
<br>
Modified: cfe/trunk/lib/AST/ASTDumper.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>ASTDumper.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/ASTDumper.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/AST/ASTDumper.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -474,6 +474,7 @@ namespace  {<br>
     void VisitUnresolvedUsingTypenameDe<wbr>cl(const UnresolvedUsingTypenameDecl *D);<br>
     void VisitUnresolvedUsingValueDecl(<wbr>const UnresolvedUsingValueDecl *D);<br>
     void VisitUsingShadowDecl(const UsingShadowDecl *D);<br>
+    void VisitConstructorUsingShadowDec<wbr>l(const ConstructorUsingShadowDecl *D);<br>
     void VisitLinkageSpecDecl(const LinkageSpecDecl *D);<br>
     void VisitAccessSpecDecl(const AccessSpecDecl *D);<br>
     void VisitFriendDecl(const FriendDecl *D);<br>
@@ -713,6 +714,12 @@ void ASTDumper::dumpTypeAsChild(<wbr>const Ty<br>
 }<br>
<br>
 void ASTDumper::dumpBareDeclRef(<wbr>const Decl *D) {<br>
+  if (!D) {<br>
+    ColorScope Color(*this, NullColor);<br>
+    OS << "<<<NULL>>>";<br>
+    return;<br>
+  }<br>
+<br>
   {<br>
     ColorScope Color(*this, DeclKindNameColor);<br>
     OS << D->getDeclKindName();<br>
@@ -1491,6 +1498,31 @@ void ASTDumper::<wbr>VisitUsingShadowDecl(con<br>
     dumpTypeAsChild(TD-><wbr>getTypeForDecl());<br>
 }<br>
<br>
+void ASTDumper::<wbr>VisitConstructorUsingShadowDec<wbr>l(<br>
+    const ConstructorUsingShadowDecl *D) {<br>
+  if (D->constructsVirtualBase())<br>
+    OS << " virtual";<br>
+<br>
+  dumpChild([=] {<br>
+    OS << "target ";<br>
+    dumpBareDeclRef(D-><wbr>getTargetDecl());<br>
+  });<br>
+<br>
+  dumpChild([=] {<br>
+    OS << "nominated ";<br>
+    dumpBareDeclRef(D-><wbr>getNominatedBaseClass());<br>
+    OS << ' ';<br>
+    dumpBareDeclRef(D-><wbr>getNominatedBaseClassShadowDec<wbr>l());<br>
+  });<br>
+<br>
+  dumpChild([=] {<br>
+    OS << "constructed ";<br>
+    dumpBareDeclRef(D-><wbr>getConstructedBaseClass());<br>
+    OS << ' ';<br>
+    dumpBareDeclRef(D-><wbr>getConstructedBaseClassShadowD<wbr>ecl());<br>
+  });<br>
+}<br>
+<br>
 void ASTDumper::<wbr>VisitLinkageSpecDecl(const LinkageSpecDecl *D) {<br>
   switch (D->getLanguage()) {<br>
   case LinkageSpecDecl::lang_c: OS << " C"; break;<br>
<br>
Modified: cfe/trunk/lib/AST/DeclBase.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>DeclBase.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/DeclBase.cpp (original)<br>
+++ cfe/trunk/lib/AST/DeclBase.cpp Tue Jun 28 14:03:57 2016<br>
@@ -594,6 +594,7 @@ unsigned Decl::<wbr>getIdentifierNamespaceFor<br>
     case Function:<br>
     case CXXMethod:<br>
     case CXXConstructor:<br>
+    case ConstructorUsingShadow:<br>
     case CXXDestructor:<br>
     case CXXConversion:<br>
     case EnumConstant:<br>
<br>
Modified: cfe/trunk/lib/AST/DeclCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>DeclCXX.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/AST/DeclCXX.cpp Tue Jun 28 14:03:57 2016<br>
@@ -448,6 +448,15 @@ void CXXRecordDecl::addedMember(<wbr>Decl *D)<br>
   FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl><wbr>(D);<br>
   if (FunTmpl)<br>
     D = FunTmpl->getTemplatedDecl();<br>
+<br>
+  // FIXME: Pass NamedDecl* to addedMember?<br>
+  Decl *DUnderlying = D;<br>
+  if (auto *ND = dyn_cast<NamedDecl>(<wbr>DUnderlying)) {<br>
+    DUnderlying = ND->getUnderlyingDecl();<br>
+    if (FunctionTemplateDecl *UnderlyingFunTmpl =<br>
+            dyn_cast<FunctionTemplateDecl><wbr>(DUnderlying))<br>
+      DUnderlying = UnderlyingFunTmpl-><wbr>getTemplatedDecl();<br>
+  }<br>
<br>
   if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {<br>
     if (Method->isVirtual()) {<br>
@@ -503,15 +512,10 @@ void CXXRecordDecl::addedMember(<wbr>Decl *D)<br>
       data().PlainOldData = false;<br>
     }<br>
<br>
-    // Technically, "user-provided" is only defined for special member<br>
-    // functions, but the intent of the standard is clearly that it should apply<br>
-    // to all functions.<br>
-    bool UserProvided = Constructor->isUserProvided();<br>
-<br>
     if (Constructor-><wbr>isDefaultConstructor()) {<br>
       SMKind |= SMF_DefaultConstructor;<br>
<br>
-      if (UserProvided)<br>
+      if (Constructor->isUserProvided()<wbr>)<br>
         data().<wbr>UserProvidedDefaultConstructor = true;<br>
       if (Constructor->isConstexpr())<br>
         data().<wbr>HasConstexprDefaultConstructor = true;<br>
@@ -529,9 +533,17 @@ void CXXRecordDecl::addedMember(<wbr>Decl *D)<br>
       } else if (Constructor-><wbr>isMoveConstructor())<br>
         SMKind |= SMF_MoveConstructor;<br>
     }<br>
+  }<br>
<br>
+  // Handle constructors, including those inherited from base classes.<br>
+  if (CXXConstructorDecl *Constructor =<br>
+          dyn_cast<CXXConstructorDecl>(<wbr>DUnderlying)) {<br>
     // Record if we see any constexpr constructors which are neither copy<br>
     // nor move constructors.<br>
+    // C++1z [basic.types]p10:<br>
+    //   [...] has at least one constexpr constructor or constructor template<br>
+    //   (possibly inherited from a base class) that is not a copy or move<br>
+    //   constructor [...]<br>
     if (Constructor->isConstexpr() && !Constructor-><wbr>isCopyOrMoveConstructor())<br>
       data().<wbr>HasConstexprNonCopyMoveConstru<wbr>ctor = true;<br>
<br>
@@ -541,8 +553,12 @@ void CXXRecordDecl::addedMember(<wbr>Decl *D)<br>
     // C++11 [dcl.init.aggr]p1:<br>
     //   An aggregate is an array or a class with no user-provided<br>
     //   constructors [...].<br>
+    // C++11 [dcl.init.aggr]p1:<br>
+    //   An aggregate is an array or a class with no user-provided<br>
+    //   constructors (including those inherited from a base class) [...].<br>
     if (getASTContext().getLangOpts()<wbr>.CPlusPlus11<br>
-          ? UserProvided : !Constructor->isImplicit())<br>
+            ? Constructor->isUserProvided()<br>
+            : !Constructor->isImplicit())<br>
       data().Aggregate = false;<br>
   }<br>
<br>
@@ -1784,11 +1800,15 @@ SourceRange CXXCtorInitializer::getSourc<br>
<br>
 void CXXConstructorDecl::anchor() { }<br>
<br>
-CXXConstructorDecl *<br>
-CXXConstructorDecl::<wbr>CreateDeserialized(ASTContext &C, unsigned ID) {<br>
-  return new (C, ID) CXXConstructorDecl(C, nullptr, SourceLocation(),<br>
-                                        DeclarationNameInfo(), QualType(),<br>
-                                        nullptr, false, false, false, false);<br>
+CXXConstructorDecl *CXXConstructorDecl::<wbr>CreateDeserialized(ASTContext &C,<br>
+                                                           unsigned ID,<br>
+                                                           bool Inherited) {<br>
+  unsigned Extra = additionalSizeToAlloc<<wbr>InheritedConstructor>(<wbr>Inherited);<br>
+  auto *Result = new (C, ID, Extra) CXXConstructorDecl(<br>
+      C, nullptr, SourceLocation(), DeclarationNameInfo(), QualType(), nullptr,<br>
+      false, false, false, false, InheritedConstructor());<br>
+  Result-><wbr>IsInheritingConstructor = Inherited;<br>
+  return Result;<br>
 }<br>
<br>
 CXXConstructorDecl *<br>
@@ -1797,13 +1817,16 @@ CXXConstructorDecl::Create(<wbr>ASTContext &C<br>
                            const DeclarationNameInfo &NameInfo,<br>
                            QualType T, TypeSourceInfo *TInfo,<br>
                            bool isExplicit, bool isInline,<br>
-                           bool isImplicitlyDeclared, bool isConstexpr) {<br>
+                           bool isImplicitlyDeclared, bool isConstexpr,<br>
+                           InheritedConstructor Inherited) {<br>
   assert(NameInfo.getName().<wbr>getNameKind()<br>
          == DeclarationName::<wbr>CXXConstructorName &&<br>
          "Name must refer to a constructor");<br>
-  return new (C, RD) CXXConstructorDecl(C, RD, StartLoc, NameInfo, T, TInfo,<br>
-                                        isExplicit, isInline,<br>
-                                        isImplicitlyDeclared, isConstexpr);<br>
+  unsigned Extra =<br>
+      additionalSizeToAlloc<<wbr>InheritedConstructor>(<wbr>Inherited ? 1 : 0);<br>
+  return new (C, RD, Extra) CXXConstructorDecl(<br>
+      C, RD, StartLoc, NameInfo, T, TInfo, isExplicit, isInline,<br>
+      isImplicitlyDeclared, isConstexpr, Inherited);<br>
 }<br>
<br>
 CXXConstructorDecl::init_<wbr>const_iterator CXXConstructorDecl::init_<wbr>begin() const {<br>
@@ -1918,23 +1941,6 @@ bool CXXConstructorDecl::<wbr>isSpecializatio<br>
   return true;<br>
 }<br>
<br>
-const CXXConstructorDecl *CXXConstructorDecl::<wbr>getInheritedConstructor() const {<br>
-  // Hack: we store the inherited constructor in the overridden method table<br>
-  method_iterator It = getASTContext().overridden_<wbr>methods_begin(this);<br>
-  if (It == getASTContext().overridden_<wbr>methods_end(this))<br>
-    return nullptr;<br>
-<br>
-  return cast<CXXConstructorDecl>(*It);<br>
-}<br>
-<br>
-void<br>
-CXXConstructorDecl::<wbr>setInheritedConstructor(const CXXConstructorDecl *BaseCtor){<br>
-  // Hack: we store the inherited constructor in the overridden method table<br>
-  assert(getASTContext().<wbr>overridden_methods_size(this) == 0 &&<br>
-         "Base ctor already set.");<br>
-  getASTContext().<wbr>addOverriddenMethod(this, BaseCtor);<br>
-}<br>
-<br>
 void CXXDestructorDecl::anchor() { }<br>
<br>
 CXXDestructorDecl *<br>
@@ -2130,10 +2136,24 @@ NamespaceAliasDecl::<wbr>CreateDeserialized(A<br>
<br>
 void UsingShadowDecl::anchor() { }<br>
<br>
+UsingShadowDecl::<wbr>UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC,<br>
+                                 SourceLocation Loc, UsingDecl *Using,<br>
+                                 NamedDecl *Target)<br>
+    : NamedDecl(K, DC, Loc, Using ? Using->getDeclName() : DeclarationName()),<br>
+      redeclarable_base(C), Underlying(Target),<br>
+      UsingOrNextShadow(cast<<wbr>NamedDecl>(Using)) {<br>
+  if (Target)<br>
+    IdentifierNamespace = Target-><wbr>getIdentifierNamespace();<br>
+  setImplicit();<br>
+}<br>
+<br>
+UsingShadowDecl::<wbr>UsingShadowDecl(Kind K, ASTContext &C, EmptyShell Empty)<br>
+    : NamedDecl(K, nullptr, SourceLocation(), DeclarationName()),<br>
+      redeclarable_base(C), Underlying(), UsingOrNextShadow() {}<br>
+<br>
 UsingShadowDecl *<br>
 UsingShadowDecl::<wbr>CreateDeserialized(ASTContext &C, unsigned ID) {<br>
-  return new (C, ID) UsingShadowDecl(C, nullptr, SourceLocation(),<br>
-                                     nullptr, nullptr);<br>
+  return new (C, ID) UsingShadowDecl(UsingShadow, C, EmptyShell());<br>
 }<br>
<br>
 UsingDecl *UsingShadowDecl::<wbr>getUsingDecl() const {<br>
@@ -2144,6 +2164,25 @@ UsingDecl *UsingShadowDecl::getUsingDecl<br>
   return cast<UsingDecl>(Shadow-><wbr>UsingOrNextShadow);<br>
 }<br>
<br>
+void ConstructorUsingShadowDecl::<wbr>anchor() { }<br>
+<br>
+ConstructorUsingShadowDecl *<br>
+ConstructorUsingShadowDecl::<wbr>Create(ASTContext &C, DeclContext *DC,<br>
+                                   SourceLocation Loc, UsingDecl *Using,<br>
+                                   NamedDecl *Target, bool IsVirtual) {<br>
+  return new (C, DC) ConstructorUsingShadowDecl(C, DC, Loc, Using, Target,<br>
+                                                IsVirtual);<br>
+}<br>
+<br>
+ConstructorUsingShadowDecl *<br>
+ConstructorUsingShadowDecl::<wbr>CreateDeserialized(ASTContext &C, unsigned ID) {<br>
+  return new (C, ID) ConstructorUsingShadowDecl(C, EmptyShell());<br>
+}<br>
+<br>
+CXXRecordDecl *ConstructorUsingShadowDecl::<wbr>getNominatedBaseClass() const {<br>
+  return getUsingDecl()->getQualifier()<wbr>->getAsRecordDecl();<br>
+}<br>
+<br>
 void UsingDecl::anchor() { }<br>
<br>
 void UsingDecl::addShadowDecl(<wbr>UsingShadowDecl *S) {<br>
<br>
Modified: cfe/trunk/lib/AST/Expr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>Expr.cpp?rev=274049&r1=274048&<wbr>r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/Expr.cpp (original)<br>
+++ cfe/trunk/lib/AST/Expr.cpp Tue Jun 28 14:03:57 2016<br>
@@ -3008,6 +3008,13 @@ bool Expr::HasSideEffects(const ASTConte<br>
     break;<br>
   }<br>
<br>
+  case CXXInheritedCtorInitExprClass: {<br>
+    const auto *ICIE = cast<CXXInheritedCtorInitExpr><wbr>(this);<br>
+    if (!ICIE->getConstructor()-><wbr>isTrivial() && IncludePossibleEffects)<br>
+      return true;<br>
+    break;<br>
+  }<br>
+<br>
   case LambdaExprClass: {<br>
     const LambdaExpr *LE = cast<LambdaExpr>(this);<br>
     for (LambdaExpr::capture_iterator I = LE->capture_begin(),<br>
<br>
Modified: cfe/trunk/lib/AST/<wbr>ExprClassification.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprClassification.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>ExprClassification.cpp?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/<wbr>ExprClassification.cpp (original)<br>
+++ cfe/trunk/lib/AST/<wbr>ExprClassification.cpp Tue Jun 28 14:03:57 2016<br>
@@ -360,6 +360,7 @@ static Cl::Kinds ClassifyInternal(ASTCon<br>
<br>
     // Some C++ expressions are always class temporaries.<br>
   case Expr::CXXConstructExprClass:<br>
+  case Expr::<wbr>CXXInheritedCtorInitExprClass:<br>
   case Expr::<wbr>CXXTemporaryObjectExprClass:<br>
   case Expr::LambdaExprClass:<br>
   case Expr::<wbr>CXXStdInitializerListExprClass<wbr>:<br>
<br>
Modified: cfe/trunk/lib/AST/<wbr>ExprConstant.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>ExprConstant.cpp?rev=274049&<wbr>r1=274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/<wbr>ExprConstant.cpp (original)<br>
+++ cfe/trunk/lib/AST/<wbr>ExprConstant.cpp Tue Jun 28 14:03:57 2016<br>
@@ -997,6 +997,16 @@ void EvalInfo::addCallStack(<wbr>unsigned Lim<br>
       continue;<br>
     }<br>
<br>
+    // Use a different note for an inheriting constructor, because from the<br>
+    // user's perspective it's not really a function at all.<br>
+    if (auto *CD = dyn_cast_or_null<<wbr>CXXConstructorDecl>(Frame-><wbr>Callee)) {<br>
+      if (CD->isInheritingConstructor()<wbr>) {<br>
+        addDiag(Frame->CallLoc, diag::note_constexpr_<wbr>inherited_ctor_call_here)<br>
+          << CD->getParent();<br>
+        continue;<br>
+      }<br>
+    }<br>
+<br>
     SmallVector<char, 128> Buffer;<br>
     llvm::raw_svector_ostream Out(Buffer);<br>
     describeCall(Frame, Out);<br>
@@ -3845,11 +3855,25 @@ static bool CheckConstexprFunction(EvalI<br>
<br>
   if (Info.getLangOpts().<wbr>CPlusPlus11) {<br>
     const FunctionDecl *DiagDecl = Definition ? Definition : Declaration;<br>
-    // FIXME: If DiagDecl is an implicitly-declared special member function, we<br>
-    // should be much more explicit about why it's not constexpr.<br>
-    Info.Diag(CallLoc, diag::note_constexpr_invalid_<wbr>function, 1)<br>
-      << DiagDecl->isConstexpr() << isa<CXXConstructorDecl>(<wbr>DiagDecl)<br>
-      << DiagDecl;<br>
+<br>
+    // If this function is not constexpr because it is an inherited<br>
+    // non-constexpr constructor, diagnose that directly.<br>
+    auto *CD = dyn_cast<CXXConstructorDecl>(<wbr>DiagDecl);<br>
+    if (CD && CD->isInheritingConstructor()) {<br>
+      auto *Inherited = CD->getInheritedConstructor().<wbr>getConstructor();<br>
+      if (!Inherited->isConstexpr())<br>
+        DiagDecl = CD = Inherited;<br>
+    }<br>
+<br>
+    // FIXME: If DiagDecl is an implicitly-declared special member function<br>
+    // or an inheriting constructor, we should be much more explicit about why<br>
+    // it's not constexpr.<br>
+    if (CD && CD->isInheritingConstructor())<br>
+      Info.Diag(CallLoc, diag::note_constexpr_invalid_<wbr>inhctor, 1)<br>
+        << CD->getInheritedConstructor().<wbr>getConstructor()->getParent();<br>
+    else<br>
+      Info.Diag(CallLoc, diag::note_constexpr_invalid_<wbr>function, 1)<br>
+        << DiagDecl->isConstexpr() << (bool)CD << DiagDecl;<br>
     Info.Note(DiagDecl-><wbr>getLocation(), diag::note_declared_at);<br>
   } else {<br>
     Info.Diag(CallLoc, diag::note_invalid_subexpr_in_<wbr>const_expr);<br>
@@ -3945,14 +3969,11 @@ static bool HandleFunctionCall(SourceLoc<br>
 }<br>
<br>
 /// Evaluate a constructor call.<br>
-static bool HandleConstructorCall(<wbr>SourceLocation CallLoc, const LValue &This,<br>
-                                  ArrayRef<const Expr*> Args,<br>
+static bool HandleConstructorCall(const Expr *E, const LValue &This,<br>
+                                  APValue *ArgValues,<br>
                                   const CXXConstructorDecl *Definition,<br>
                                   EvalInfo &Info, APValue &Result) {<br>
-  ArgVector ArgValues(Args.size());<br>
-  if (!EvaluateArgs(Args, ArgValues, Info))<br>
-    return false;<br>
-<br>
+  SourceLocation CallLoc = E->getExprLoc();<br>
   if (!Info.CheckCallLimit(CallLoc)<wbr>)<br>
     return false;<br>
<br>
@@ -3962,14 +3983,14 @@ static bool HandleConstructorCall(Source<br>
     return false;<br>
   }<br>
<br>
-  CallStackFrame Frame(Info, CallLoc, Definition, &This, ArgValues.data());<br>
+  CallStackFrame Frame(Info, CallLoc, Definition, &This, ArgValues);<br>
<br>
   // FIXME: Creating an APValue just to hold a nonexistent return value is<br>
   // wasteful.<br>
   APValue RetVal;<br>
   StmtResult Ret = {RetVal, nullptr};<br>
<br>
-  // If it's a delegating constructor, just delegate.<br>
+  // If it's a delegating constructor, delegate.<br>
   if (Definition-><wbr>isDelegatingConstructor()) {<br>
     CXXConstructorDecl::init_<wbr>const_iterator I = Definition->init_begin();<br>
     {<br>
@@ -3993,8 +4014,9 @@ static bool HandleConstructorCall(Source<br>
        (Definition->isTrivial() && hasFields(Definition-><wbr>getParent())))) {<br>
     LValue RHS;<br>
     RHS.setFrom(Info.Ctx, ArgValues[0]);<br>
-    return handleLValueToRValueConversion<wbr>(Info, Args[0], Args[0]->getType(),<br>
-                                          RHS, Result);<br>
+    return handleLValueToRValueConversion<wbr>(<br>
+        Info, E, Definition->getParamDecl(0)-><wbr>getType().getNonReferenceType(<wbr>),<br>
+        RHS, Result);<br>
   }<br>
<br>
   // Reserve space for the struct members.<br>
@@ -4088,6 +4110,18 @@ static bool HandleConstructorCall(Source<br>
          EvaluateStmt(Ret, Info, Definition->getBody()) != ESR_Failed;<br>
 }<br>
<br>
+static bool HandleConstructorCall(const Expr *E, const LValue &This,<br>
+                                  ArrayRef<const Expr*> Args,<br>
+                                  const CXXConstructorDecl *Definition,<br>
+                                  EvalInfo &Info, APValue &Result) {<br>
+  ArgVector ArgValues(Args.size());<br>
+  if (!EvaluateArgs(Args, ArgValues, Info))<br>
+    return false;<br>
+<br>
+  return HandleConstructorCall(E, This, ArgValues.data(), Definition,<br>
+                               Info, Result);<br>
+}<br>
+<br>
 //===-------------------------<wbr>------------------------------<wbr>---------------===//<br>
 // Generic Evaluation<br>
 //===-------------------------<wbr>------------------------------<wbr>---------------===//<br>
@@ -5380,6 +5414,7 @@ namespace {<br>
     bool VisitCXXConstructExpr(const CXXConstructExpr *E) {<br>
       return VisitCXXConstructExpr(E, E->getType());<br>
     }<br>
+    bool VisitCXXInheritedCtorInitExpr(<wbr>const CXXInheritedCtorInitExpr *E);<br>
     bool VisitCXXConstructExpr(const CXXConstructExpr *E, QualType T);<br>
     bool VisitCXXStdInitializerListExpr<wbr>(const CXXStdInitializerListExpr *E);<br>
   };<br>
@@ -5631,7 +5666,29 @@ bool RecordExprEvaluator::<wbr>VisitCXXConstr<br>
     return false;<br>
<br>
   auto Args = llvm::makeArrayRef(E->getArgs(<wbr>), E->getNumArgs());<br>
-  return HandleConstructorCall(E-><wbr>getExprLoc(), This, Args,<br>
+  return HandleConstructorCall(E, This, Args,<br>
+                               cast<CXXConstructorDecl>(<wbr>Definition), Info,<br>
+                               Result);<br>
+}<br>
+<br>
+bool RecordExprEvaluator::<wbr>VisitCXXInheritedCtorInitExpr(<br>
+    const CXXInheritedCtorInitExpr *E) {<br>
+  if (!Info.CurrentCall) {<br>
+    assert(Info.<wbr>checkingPotentialConstantExpre<wbr>ssion());<br>
+    return false;<br>
+  }<br>
+<br>
+  const CXXConstructorDecl *FD = E->getConstructor();<br>
+  if (FD->isInvalidDecl() || FD->getParent()-><wbr>isInvalidDecl())<br>
+    return false;<br>
+<br>
+  const FunctionDecl *Definition = nullptr;<br>
+  auto Body = FD->getBody(Definition);<br>
+<br>
+  if (!CheckConstexprFunction(Info, E->getExprLoc(), FD, Definition, Body))<br>
+    return false;<br>
+<br>
+  return HandleConstructorCall(E, This, Info.CurrentCall->Arguments,<br>
                                cast<CXXConstructorDecl>(<wbr>Definition), Info,<br>
                                Result);<br>
 }<br>
@@ -9305,6 +9362,7 @@ static ICEDiag CheckICE(const Expr* E, c<br>
   case Expr::TypoExprClass:<br>
   case Expr::<wbr>DependentScopeDeclRefExprClass<wbr>:<br>
   case Expr::CXXConstructExprClass:<br>
+  case Expr::<wbr>CXXInheritedCtorInitExprClass:<br>
   case Expr::<wbr>CXXStdInitializerListExprClass<wbr>:<br>
   case Expr::<wbr>CXXBindTemporaryExprClass:<br>
   case Expr::ExprWithCleanupsClass:<br>
@@ -9768,17 +9826,17 @@ bool Expr::isPotentialConstantExpr(<wbr>const<br>
<br>
   ArrayRef<const Expr*> Args;<br>
<br>
-  SourceLocation Loc = FD->getLocation();<br>
-<br>
   APValue Scratch;<br>
   if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(<wbr>FD)) {<br>
     // Evaluate the call as a constant initializer, to allow the construction<br>
     // of objects of non-literal types.<br>
     Info.setEvaluatingDecl(This.<wbr>getLValueBase(), Scratch);<br>
-    HandleConstructorCall(Loc, This, Args, CD, Info, Scratch);<br>
-  } else<br>
+    HandleConstructorCall(&VIE, This, Args, CD, Info, Scratch);<br>
+  } else {<br>
+    SourceLocation Loc = FD->getLocation();<br>
     HandleFunctionCall(Loc, FD, (MD && MD->isInstance()) ? &This : nullptr,<br>
                        Args, FD->getBody(), Info, Scratch, nullptr);<br>
+  }<br>
<br>
   return Diags.empty();<br>
 }<br>
<br>
Modified: cfe/trunk/lib/AST/<wbr>ItaniumMangle.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>ItaniumMangle.cpp?rev=274049&<wbr>r1=274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/<wbr>ItaniumMangle.cpp (original)<br>
+++ cfe/trunk/lib/AST/<wbr>ItaniumMangle.cpp Tue Jun 28 14:03:57 2016<br>
@@ -397,7 +397,7 @@ private:<br>
   void mangleCastExpression(const Expr *E, StringRef CastEncoding);<br>
   void mangleInitListElements(const InitListExpr *InitList);<br>
   void mangleExpression(const Expr *E, unsigned Arity = UnknownArity);<br>
-  void mangleCXXCtorType(CXXCtorType T);<br>
+  void mangleCXXCtorType(CXXCtorType T, const CXXRecordDecl *InheritedFrom);<br>
   void mangleCXXDtorType(CXXDtorType T);<br>
<br>
   void mangleTemplateArgs(const TemplateArgumentLoc *TemplateArgs,<br>
@@ -502,6 +502,12 @@ void CXXNameMangler::<wbr>mangleFunctionEncod<br>
     FunctionTypeDepth.pop(Saved);<br>
   }<br>
<br>
+  // When mangling an inheriting constructor, the bare function type used is<br>
+  // that of the inherited constructor.<br>
+  if (auto *CD = dyn_cast<CXXConstructorDecl>(<wbr>FD))<br>
+    if (auto Inherited = CD->getInheritedConstructor())<br>
+      FD = Inherited.getConstructor();<br>
+<br>
   // Whether the mangling of a function type includes the return type depends on<br>
   // the context and the nature of the function. The rules for deciding whether<br>
   // the return type is included are:<br>
@@ -562,7 +568,7 @@ static bool isStdNamespace(const DeclCon<br>
 static const TemplateDecl *<br>
 isTemplate(const NamedDecl *ND, const TemplateArgumentList *&TemplateArgs) {<br>
   // Check if we have a function template.<br>
-  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)){<br>
+  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {<br>
     if (const TemplateDecl *TD = FD->getPrimaryTemplate()) {<br>
       TemplateArgs = FD-><wbr>getTemplateSpecializationArgs(<wbr>);<br>
       return TD;<br>
@@ -1048,16 +1054,31 @@ void CXXNameMangler::<wbr>mangleUnqualifiedNa<br>
   case DeclarationName::<wbr>ObjCMultiArgSelector:<br>
     llvm_unreachable("Can't mangle Objective-C selector names here!");<br>
<br>
-  case DeclarationName::<wbr>CXXConstructorName:<br>
+  case DeclarationName::<wbr>CXXConstructorName: {<br>
+    const CXXRecordDecl *InheritedFrom = nullptr;<br>
+    const TemplateArgumentList *InheritedTemplateArgs = nullptr;<br>
+    if (auto Inherited =<br>
+            cast<CXXConstructorDecl>(ND)-><wbr>getInheritedConstructor()) {<br>
+      InheritedFrom = Inherited.getConstructor()-><wbr>getParent();<br>
+      InheritedTemplateArgs =<br>
+          Inherited.getConstructor()-><wbr>getTemplateSpecializationArgs(<wbr>);<br>
+    }<br>
+<br>
     if (ND == Structor)<br>
       // If the named decl is the C++ constructor we're mangling, use the type<br>
       // we were given.<br>
-      mangleCXXCtorType(static_cast<<wbr>CXXCtorType>(StructorType));<br>
+      mangleCXXCtorType(static_cast<<wbr>CXXCtorType>(StructorType), InheritedFrom);<br>
     else<br>
       // Otherwise, use the complete constructor name. This is relevant if a<br>
       // class with a constructor is declared within a constructor.<br>
-      mangleCXXCtorType(Ctor_<wbr>Complete);<br>
+      mangleCXXCtorType(Ctor_<wbr>Complete, InheritedFrom);<br>
+<br>
+    // FIXME: The template arguments are part of the enclosing prefix or<br>
+    // nested-name, but it's more convenient to mangle them here.<br>
+    if (InheritedTemplateArgs)<br>
+      mangleTemplateArgs(*<wbr>InheritedTemplateArgs);<br>
     break;<br>
+  }<br>
<br>
   case DeclarationName::<wbr>CXXDestructorName:<br>
     if (ND == Structor)<br>
@@ -2909,6 +2930,7 @@ recurse:<br>
   case Expr::<wbr>MSPropertySubscriptExprClass:<br>
   case Expr::TypoExprClass:  // This should no longer exist in the AST by now.<br>
   case Expr::<wbr>OMPArraySectionExprClass:<br>
+  case Expr::<wbr>CXXInheritedCtorInitExprClass:<br>
     llvm_unreachable("unexpected statement kind");<br>
<br>
   // FIXME: invent manglings for all these.<br>
@@ -3688,25 +3710,33 @@ void CXXNameMangler::<wbr>mangleFunctionParam<br>
   Out << '_';<br>
 }<br>
<br>
-void CXXNameMangler::<wbr>mangleCXXCtorType(CXXCtorType T) {<br>
+void CXXNameMangler::<wbr>mangleCXXCtorType(CXXCtorType T,<br>
+                                       const CXXRecordDecl *InheritedFrom) {<br>
   // <ctor-dtor-name> ::= C1  # complete object constructor<br>
   //                  ::= C2  # base object constructor<br>
+  //                  ::= CI1 <type> # complete inheriting constructor<br>
+  //                  ::= CI2 <type> # base inheriting constructor<br>
   //<br>
   // In addition, C5 is a comdat name with C1 and C2 in it.<br>
+  Out << 'C';<br>
+  if (InheritedFrom)<br>
+    Out << 'I';<br>
   switch (T) {<br>
   case Ctor_Complete:<br>
-    Out << "C1";<br>
+    Out << '1';<br>
     break;<br>
   case Ctor_Base:<br>
-    Out << "C2";<br>
+    Out << '2';<br>
     break;<br>
   case Ctor_Comdat:<br>
-    Out << "C5";<br>
+    Out << '5';<br>
     break;<br>
   case Ctor_DefaultClosure:<br>
   case Ctor_CopyingClosure:<br>
     llvm_unreachable("closure constructors don't exist for the Itanium ABI!");<br>
   }<br>
+  if (InheritedFrom)<br>
+    mangleName(InheritedFrom);<br>
 }<br>
<br>
 void CXXNameMangler::<wbr>mangleCXXDtorType(CXXDtorType T) {<br>
<br>
Modified: cfe/trunk/lib/AST/<wbr>NestedNameSpecifier.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NestedNameSpecifier.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>NestedNameSpecifier.cpp?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/<wbr>NestedNameSpecifier.cpp (original)<br>
+++ cfe/trunk/lib/AST/<wbr>NestedNameSpecifier.cpp Tue Jun 28 14:03:57 2016<br>
@@ -171,10 +171,19 @@ NamespaceAliasDecl *NestedNameSpecifier:<br>
<br>
 /// \brief Retrieve the record declaration stored in this nested name specifier.<br>
 CXXRecordDecl *NestedNameSpecifier::<wbr>getAsRecordDecl() const {<br>
-  if (Prefix.getInt() == StoredDecl)<br>
+  switch (Prefix.getInt()) {<br>
+  case StoredIdentifier:<br>
+    return nullptr;<br>
+<br>
+  case StoredDecl:<br>
     return dyn_cast<CXXRecordDecl>(<wbr>static_cast<NamedDecl *>(Specifier));<br>
<br>
-  return nullptr;<br>
+  case StoredTypeSpec:<br>
+  case StoredTypeSpecWithTemplate:<br>
+    return getAsType()-><wbr>getAsCXXRecordDecl();<br>
+  }<br>
+<br>
+  llvm_unreachable("Invalid NNS Kind!");<br>
 }<br>
<br>
 /// \brief Whether this nested name specifier refers to a dependent<br>
<br>
Modified: cfe/trunk/lib/AST/StmtPrinter.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>StmtPrinter.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/StmtPrinter.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/AST/StmtPrinter.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -2188,6 +2188,11 @@ void StmtPrinter::<wbr>VisitCXXConstructExpr(<br>
     OS << "}";<br>
 }<br>
<br>
+void StmtPrinter::<wbr>VisitCXXInheritedCtorInitExpr(<wbr>CXXInheritedCtorInitExpr *E) {<br>
+  // Parens are printed by the surrounding context.<br>
+  OS << "<forwarded>";<br>
+}<br>
+<br>
 void StmtPrinter::<wbr>VisitCXXStdInitializerListExpr<wbr>(CXXStdInitializerListExpr *E) {<br>
   PrintExpr(E->getSubExpr());<br>
 }<br>
<br>
Modified: cfe/trunk/lib/AST/StmtProfile.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>StmtProfile.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/StmtProfile.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/AST/StmtProfile.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -1287,6 +1287,12 @@ void StmtProfiler::<wbr>VisitCXXConstructExpr<br>
   ID.AddBoolean(S->isElidable())<wbr>;<br>
 }<br>
<br>
+void StmtProfiler::<wbr>VisitCXXInheritedCtorInitExpr(<br>
+    const CXXInheritedCtorInitExpr *S) {<br>
+  VisitExpr(S);<br>
+  VisitDecl(S->getConstructor())<wbr>;<br>
+}<br>
+<br>
 void StmtProfiler::<wbr>VisitCXXFunctionalCastExpr(<wbr>const CXXFunctionalCastExpr *S) {<br>
   VisitExplicitCastExpr(S);<br>
 }<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGCall.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>CGCall.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/CodeGen/CGCall.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGCall.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -244,6 +244,15 @@ CodeGenTypes::<wbr>arrangeCXXMethodDeclaratio<br>
   return arrangeFreeFunctionType(<wbr>prototype, MD);<br>
 }<br>
<br>
+bool CodeGenTypes::<wbr>inheritingCtorHasParams(<br>
+    const InheritedConstructor &Inherited, CXXCtorType Type) {<br>
+  // Parameters are unnecessary if we're constructing a base class subobject<br>
+  // and the inherited constructor lives in a virtual base.<br>
+  return Type == Ctor_Complete ||<br>
+         !Inherited.getShadowDecl()-><wbr>constructsVirtualBase() ||<br>
+         !Target.getCXXABI().<wbr>hasConstructorVariants();<br>
+  }<br>
+<br>
 const CGFunctionInfo &<br>
 CodeGenTypes::<wbr>arrangeCXXStructorDeclaration(<wbr>const CXXMethodDecl *MD,<br>
                                             StructorType Type) {<br>
@@ -252,9 +261,16 @@ CodeGenTypes::<wbr>arrangeCXXStructorDeclarat<br>
   SmallVector<FunctionProtoType:<wbr>:ExtParameterInfo, 16> paramInfos;<br>
   argTypes.push_back(<wbr>GetThisType(Context, MD->getParent()));<br>
<br>
+  bool PassParams = true;<br>
+<br>
   GlobalDecl GD;<br>
   if (auto *CD = dyn_cast<CXXConstructorDecl>(<wbr>MD)) {<br>
     GD = GlobalDecl(CD, toCXXCtorType(Type));<br>
+<br>
+    // A base class inheriting constructor doesn't get forwarded arguments<br>
+    // needed to construct a virtual base (or base class thereof).<br>
+    if (auto Inherited = CD->getInheritedConstructor())<br>
+      PassParams = inheritingCtorHasParams(<wbr>Inherited, toCXXCtorType(Type));<br>
   } else {<br>
     auto *DD = dyn_cast<CXXDestructorDecl>(<wbr>MD);<br>
     GD = GlobalDecl(DD, toCXXDtorType(Type));<br>
@@ -263,12 +279,14 @@ CodeGenTypes::<wbr>arrangeCXXStructorDeclarat<br>
   CanQual<FunctionProtoType> FTP = GetFormalType(MD);<br>
<br>
   // Add the formal parameters.<br>
-  appendParameterTypes(*this, argTypes, paramInfos, FTP, MD);<br>
+  if (PassParams)<br>
+    appendParameterTypes(*this, argTypes, paramInfos, FTP, MD);<br>
<br>
   TheCXXABI.<wbr>buildStructorSignature(MD, Type, argTypes);<br>
<br>
   RequiredArgs required =<br>
-      (MD->isVariadic() ? RequiredArgs(argTypes.size()) : RequiredArgs::All);<br>
+      (PassParams && MD->isVariadic() ? RequiredArgs(argTypes.size())<br>
+                                      : RequiredArgs::All);<br>
<br>
   FunctionType::ExtInfo extInfo = FTP->getExtInfo();<br>
   CanQualType resultType = TheCXXABI.HasThisReturn(GD)<br>
@@ -3186,10 +3204,10 @@ void CodeGenFunction::EmitCallArgs(<br>
     size_t CallArgsStart = Args.size();<br>
     for (int I = ArgTypes.size() - 1; I >= 0; --I) {<br>
       CallExpr::const_arg_iterator Arg = ArgRange.begin() + I;<br>
+      MaybeEmitImplicitObjectSize(I, *Arg);<br>
       EmitCallArg(Args, *Arg, ArgTypes[I]);<br>
       EmitNonNullArgCheck(Args.back(<wbr>).RV, ArgTypes[I], (*Arg)->getExprLoc(),<br>
                           CalleeDecl, ParamsToSkip + I);<br>
-      MaybeEmitImplicitObjectSize(I, *Arg);<br>
     }<br>
<br>
     // Un-reverse the arguments we just evaluated so they match up with the LLVM<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGClass.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>CGClass.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/CodeGen/CGClass.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGClass.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -2048,6 +2048,62 @@ void CodeGenFunction::<wbr>EmitCXXConstructor<br>
                                              bool ForVirtualBase,<br>
                                              bool Delegating, Address This,<br>
                                              const CXXConstructExpr *E) {<br>
+  CallArgList Args;<br>
+<br>
+  // Push the this ptr.<br>
+  Args.add(RValue::get(This.<wbr>getPointer()), D->getThisType(getContext()));<br>
+<br>
+  // If this is a trivial constructor, emit a memcpy now before we lose<br>
+  // the alignment information on the argument.<br>
+  // FIXME: It would be better to preserve alignment information into CallArg.<br>
+  if (<wbr>isMemcpyEquivalentSpecialMembe<wbr>r(D)) {<br>
+    assert(E->getNumArgs() == 1 && "unexpected argcount for trivial ctor");<br>
+<br>
+    const Expr *Arg = E->getArg(0);<br>
+    QualType SrcTy = Arg->getType();<br>
+    Address Src = EmitLValue(Arg).getAddress();<br>
+    QualType DestTy = getContext().getTypeDeclType(<wbr>D->getParent());<br>
+    EmitAggregateCopyCtor(This, Src, DestTy, SrcTy);<br>
+    return;<br>
+  }<br>
+<br>
+  // Add the rest of the user-supplied arguments.<br>
+  const FunctionProtoType *FPT = D->getType()->castAs<<wbr>FunctionProtoType>();<br>
+  EmitCallArgs(Args, FPT, E->arguments(), E->getConstructor());<br>
+<br>
+  EmitCXXConstructorCall(D, Type, ForVirtualBase, Delegating, This, Args);<br>
+}<br>
+<br>
+static bool canEmitDelegateCallArgs(<wbr>CodeGenFunction &CGF,<br>
+                                    const CXXConstructorDecl *Ctor,<br>
+                                    CXXCtorType Type, CallArgList &Args) {<br>
+  // We can't forward a variadic call.<br>
+  if (Ctor->isVariadic())<br>
+    return false;<br>
+<br>
+  if (CGF.getTarget().getCXXABI().<wbr>areArgsDestroyedLeftToRightInC<wbr>allee()) {<br>
+    // If the parameters are callee-cleanup, it's not safe to forward.<br>
+    for (auto *P : Ctor->parameters())<br>
+      if (P->getType().<wbr>isDestructedType())<br>
+        return false;<br>
+<br>
+    // Likewise if they're inalloca.<br>
+    const CGFunctionInfo &Info =<br>
+        CGF.CGM.getTypes().<wbr>arrangeCXXConstructorCall(<wbr>Args, Ctor, Type, 0);<br>
+    if (Info.usesInAlloca())<br>
+      return false;<br>
+  }<br>
+<br>
+  // Anything else should be OK.<br>
+  return true;<br>
+}<br>
+<br>
+void CodeGenFunction::<wbr>EmitCXXConstructorCall(const CXXConstructorDecl *D,<br>
+                                             CXXCtorType Type,<br>
+                                             bool ForVirtualBase,<br>
+                                             bool Delegating,<br>
+                                             Address This,<br>
+                                             CallArgList &Args) {<br>
   const CXXRecordDecl *ClassDecl = D->getParent();<br>
<br>
   // C++11 [class.mfct.non-static]p2:<br>
@@ -2058,7 +2114,7 @@ void CodeGenFunction::<wbr>EmitCXXConstructor<br>
                 This.getPointer(), getContext().getRecordType(<wbr>ClassDecl));<br>
<br>
   if (D->isTrivial() && D->isDefaultConstructor()) {<br>
-    assert(E->getNumArgs() == 0 && "trivial default ctor with args");<br>
+    assert(Args.size() == 1 && "trivial default ctor with args");<br>
     return;<br>
   }<br>
<br>
@@ -2066,24 +2122,24 @@ void CodeGenFunction::<wbr>EmitCXXConstructor<br>
   // union copy constructor, we must emit a memcpy, because the AST does not<br>
   // model that copy.<br>
   if (<wbr>isMemcpyEquivalentSpecialMembe<wbr>r(D)) {<br>
-    assert(E->getNumArgs() == 1 && "unexpected argcount for trivial ctor");<br>
+    assert(Args.size() == 2 && "unexpected argcount for trivial ctor");<br>
<br>
-    const Expr *Arg = E->getArg(0);<br>
-    QualType SrcTy = Arg->getType();<br>
-    Address Src = EmitLValue(Arg).getAddress();<br>
+    QualType SrcTy = D->getParamDecl(0)->getType().<wbr>getNonReferenceType();<br>
+    Address Src(Args[1].RV.getScalarVal(), getNaturalTypeAlignment(SrcTy)<wbr>);<br>
     QualType DestTy = getContext().getTypeDeclType(<wbr>ClassDecl);<br>
     EmitAggregateCopyCtor(This, Src, DestTy, SrcTy);<br>
     return;<br>
   }<br>
<br>
-  CallArgList Args;<br>
-<br>
-  // Push the this ptr.<br>
-  Args.add(RValue::get(This.<wbr>getPointer()), D->getThisType(getContext()));<br>
-<br>
-  // Add the rest of the user-supplied arguments.<br>
-  const FunctionProtoType *FPT = D->getType()->castAs<<wbr>FunctionProtoType>();<br>
-  EmitCallArgs(Args, FPT, E->arguments(), E->getConstructor());<br>
+  // Check whether we can actually emit the constructor before trying to do so.<br>
+  if (auto Inherited = D->getInheritedConstructor()) {<br>
+    if (getTypes().<wbr>inheritingCtorHasParams(<wbr>Inherited, Type) &&<br>
+        !canEmitDelegateCallArgs(*<wbr>this, D, Type, Args)) {<br>
+      EmitInlinedInheritingCXXConstr<wbr>uctorCall(D, Type, ForVirtualBase,<br>
+                                              Delegating, Args);<br>
+      return;<br>
+    }<br>
+  }<br>
<br>
   // Insert any ABI-specific implicit constructor arguments.<br>
   unsigned ExtraArgs = CGM.getCXXABI().<wbr>addImplicitConstructorArgs(<br>
@@ -2113,6 +2169,95 @@ void CodeGenFunction::<wbr>EmitCXXConstructor<br>
     EmitVTableAssumptionLoads(<wbr>ClassDecl, This);<br>
 }<br>
<br>
+void CodeGenFunction::<wbr>EmitInheritedCXXConstructorCal<wbr>l(<br>
+    const CXXConstructorDecl *D, bool ForVirtualBase, Address This,<br>
+    bool InheritedFromVBase, const CXXInheritedCtorInitExpr *E) {<br>
+  CallArgList Args;<br>
+  CallArg ThisArg(RValue::get(This.<wbr>getPointer()), D->getThisType(getContext()),<br>
+                  /*NeedsCopy=*/false);<br>
+<br>
+  // Forward the parameters.<br>
+  if (InheritedFromVBase &&<br>
+      CGM.getTarget().getCXXABI().<wbr>hasConstructorVariants()) {<br>
+    // Nothing to do; this construction is not responsible for constructing<br>
+    // the base class containing the inherited constructor.<br>
+    // FIXME: Can we just pass undef's for the remaining arguments if we don't<br>
+    // have constructor variants?<br>
+    Args.push_back(ThisArg);<br>
+  } else if (!<wbr>CXXInheritedCtorInitExprArgs.<wbr>empty()) {<br>
+    // The inheriting constructor was inlined; just inject its arguments.<br>
+    assert(<wbr>CXXInheritedCtorInitExprArgs.<wbr>size() >= D->getNumParams() &&<br>
+           "wrong number of parameters for inherited constructor call");<br>
+    Args = CXXInheritedCtorInitExprArgs;<br>
+    Args[0] = ThisArg;<br>
+  } else {<br>
+    // The inheriting constructor was not inlined. Emit delegating arguments.<br>
+    Args.push_back(ThisArg);<br>
+    const auto *OuterCtor = cast<CXXConstructorDecl>(<wbr>CurCodeDecl);<br>
+    assert(OuterCtor-><wbr>getNumParams() == D->getNumParams());<br>
+    assert(!OuterCtor->isVariadic(<wbr>) && "should have been inlined");<br>
+<br>
+    for (const auto *Param : OuterCtor->parameters()) {<br>
+      assert(getContext().<wbr>hasSameUnqualifiedType(<br>
+          OuterCtor->getParamDecl(Param-<wbr>>getFunctionScopeIndex())-><wbr>getType(),<br>
+          Param->getType()));<br>
+      EmitDelegateCallArg(Args, Param, E->getLocation());<br>
+<br>
+      // Forward __attribute__(pass_object_<wbr>size).<br>
+      if (Param->hasAttr<<wbr>PassObjectSizeAttr>()) {<br>
+        auto *POSParam = SizeArguments[Param];<br>
+        assert(POSParam && "missing pass_object_size value for forwarding");<br>
+        EmitDelegateCallArg(Args, POSParam, E->getLocation());<br>
+      }<br>
+    }<br>
+  }<br>
+<br>
+  EmitCXXConstructorCall(D, Ctor_Base, ForVirtualBase, /*Delegating*/false,<br>
+                         This, Args);<br>
+}<br>
+<br>
+void CodeGenFunction::<wbr>EmitInlinedInheritingCXXConstr<wbr>uctorCall(<br>
+    const CXXConstructorDecl *Ctor, CXXCtorType CtorType, bool ForVirtualBase,<br>
+    bool Delegating, CallArgList &Args) {<br>
+  InlinedInheritingConstructorSc<wbr>ope Scope(*this, GlobalDecl(Ctor, CtorType));<br>
+<br>
+  // Save the arguments to be passed to the inherited constructor.<br>
+  CXXInheritedCtorInitExprArgs = Args;<br>
+<br>
+  FunctionArgList Params;<br>
+  QualType RetType = BuildFunctionArgList(CurGD, Params);<br>
+  FnRetTy = RetType;<br>
+<br>
+  // Insert any ABI-specific implicit constructor arguments.<br>
+  CGM.getCXXABI().<wbr>addImplicitConstructorArgs(*<wbr>this, Ctor, CtorType,<br>
+                                             ForVirtualBase, Delegating, Args);<br>
+<br>
+  // Emit a simplified prolog. We only need to emit the implicit params.<br>
+  assert(Args.size() >= Params.size() && "too few arguments for call");<br>
+  for (unsigned I = 0, N = Args.size(); I != N; ++I) {<br>
+    if (I < Params.size() && isa<ImplicitParamDecl>(Params[<wbr>I])) {<br>
+      const RValue &RV = Args[I].RV;<br>
+      assert(!RV.isComplex() && "complex indirect params not supported");<br>
+      ParamValue Val = RV.isScalar()<br>
+                           ? ParamValue::forDirect(RV.<wbr>getScalarVal())<br>
+                           : ParamValue::forIndirect(RV.<wbr>getAggregateAddress());<br>
+      EmitParmDecl(*Params[I], Val, I + 1);<br>
+    }<br>
+  }<br>
+<br>
+  // Create a return value slot if the ABI implementation wants one.<br>
+  // FIXME: This is dumb, we should ask the ABI not to try to set the return<br>
+  // value instead.<br>
+  if (!RetType->isVoidType())<br>
+    ReturnValue = CreateIRTemp(RetType, "retval.inhctor");<br>
+<br>
+  CGM.getCXXABI().<wbr>EmitInstanceFunctionProlog(*<wbr>this);<br>
+  CXXThisValue = CXXABIThisValue;<br>
+<br>
+  // Directly emit the constructor initializers.<br>
+  EmitCtorPrologue(Ctor, CtorType, Params);<br>
+}<br>
+<br>
 void CodeGenFunction::<wbr>EmitVTableAssumptionLoad(const VPtr &Vptr, Address This) {<br>
   llvm::Value *VTableGlobal =<br>
       CGM.getCXXABI().<wbr>getVTableAddressPoint(Vptr.<wbr>Base, Vptr.VTableClass);<br>
@@ -2145,19 +2290,6 @@ void<br>
 CodeGenFunction::<wbr>EmitSynthesizedCXXCopyCtorCall<wbr>(const CXXConstructorDecl *D,<br>
                                                 Address This, Address Src,<br>
                                                 const CXXConstructExpr *E) {<br>
-  if (<wbr>isMemcpyEquivalentSpecialMembe<wbr>r(D)) {<br>
-    assert(E->getNumArgs() == 1 && "unexpected argcount for trivial ctor");<br>
-    assert(D-><wbr>isCopyOrMoveConstructor() &&<br>
-           "trivial 1-arg ctor not a copy/move ctor");<br>
-    EmitAggregateCopyCtor(This, Src,<br>
-                          getContext().getTypeDeclType(<wbr>D->getParent()),<br>
-                          (*E->arg_begin())->getType());<br>
-    return;<br>
-  }<br>
-  llvm::Value *Callee = CGM.getAddrOfCXXStructor(D, StructorType::Complete);<br>
-  assert(D->isInstance() &&<br>
-         "Trying to emit a member call expr on a static method!");<br>
-<br>
   const FunctionProtoType *FPT = D->getType()->castAs<<wbr>FunctionProtoType>();<br>
<br>
   CallArgList Args;<br>
@@ -2175,8 +2307,7 @@ CodeGenFunction::<wbr>EmitSynthesizedCXXCopyC<br>
   EmitCallArgs(Args, FPT, drop_begin(E->arguments(), 1), E->getConstructor(),<br>
                /*ParamsToSkip*/ 1);<br>
<br>
-  EmitCall(CGM.getTypes().<wbr>arrangeCXXMethodCall(Args, FPT, RequiredArgs::All),<br>
-           Callee, ReturnValueSlot(), Args, D);<br>
+  EmitCXXConstructorCall(D, Ctor_Complete, false, false, This, Args);<br>
 }<br>
<br>
 void<br>
@@ -2190,21 +2321,17 @@ CodeGenFunction::<wbr>EmitDelegateCXXConstruc<br>
   assert(I != E && "no parameters to constructor");<br>
<br>
   // this<br>
-  DelegateArgs.add(RValue::get(<wbr>LoadCXXThis()), (*I)->getType());<br>
+  Address This = LoadCXXThisAddress();<br>
+  DelegateArgs.add(RValue::get(<wbr>This.getPointer()), (*I)->getType());<br>
   ++I;<br>
<br>
-  // vtt<br>
-  if (llvm::Value *VTT = GetVTTParameter(GlobalDecl(<wbr>Ctor, CtorType),<br>
-                                         /*ForVirtualBase=*/false,<br>
-                                         /*Delegating=*/true)) {<br>
-    QualType VoidPP = getContext().getPointerType(<wbr>getContext().VoidPtrTy);<br>
-    DelegateArgs.add(RValue::get(<wbr>VTT), VoidPP);<br>
-<br>
-    if (CGM.getCXXABI().<wbr>NeedsVTTParameter(CurGD)) {<br>
-      assert(I != E && "cannot skip vtt parameter, already done with args");<br>
-      assert((*I)->getType() == VoidPP && "skipping parameter not of vtt type");<br>
-      ++I;<br>
-    }<br>
+  // FIXME: The location of the VTT parameter in the parameter list is<br>
+  // specific to the Itanium ABI and shouldn't be hardcoded here.<br>
+  if (CGM.getCXXABI().<wbr>NeedsVTTParameter(CurGD)) {<br>
+    assert(I != E && "cannot skip vtt parameter, already done with args");<br>
+    assert((*I)->getType()-><wbr>isPointerType() &&<br>
+           "skipping parameter not of vtt type");<br>
+    ++I;<br>
   }<br>
<br>
   // Explicit arguments.<br>
@@ -2214,11 +2341,8 @@ CodeGenFunction::<wbr>EmitDelegateCXXConstruc<br>
     EmitDelegateCallArg(<wbr>DelegateArgs, param, Loc);<br>
   }<br>
<br>
-  llvm::Value *Callee =<br>
-      CGM.getAddrOfCXXStructor(Ctor, getFromCtorType(CtorType));<br>
-  EmitCall(CGM.getTypes()<br>
-               .<wbr>arrangeCXXStructorDeclaration(<wbr>Ctor, getFromCtorType(CtorType)),<br>
-           Callee, ReturnValueSlot(), DelegateArgs, Ctor);<br>
+  EmitCXXConstructorCall(Ctor, CtorType, /*ForVirtualBase=*/false,<br>
+                         /*Delegating=*/true, This, DelegateArgs);<br>
 }<br>
<br>
 namespace {<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDecl.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>CGDecl.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/CodeGen/CGDecl.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDecl.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -85,6 +85,7 @@ void CodeGenFunction::EmitDecl(<wbr>const Dec<br>
   case Decl::Captured:<br>
   case Decl::<wbr>ClassScopeFunctionSpecializati<wbr>on:<br>
   case Decl::UsingShadow:<br>
+  case Decl::ConstructorUsingShadow:<br>
   case Decl::ObjCTypeParam:<br>
     llvm_unreachable("Declaration should not be in declstmts!");<br>
   case Decl::Function:  // void X();<br>
<br>
Modified: cfe/trunk/lib/CodeGen/<wbr>CGExprAgg.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>CGExprAgg.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/CodeGen/<wbr>CGExprAgg.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/<wbr>CGExprAgg.cpp Tue Jun 28 14:03:57 2016<br>
@@ -175,6 +175,7 @@ public:<br>
   }<br>
   void VisitCXXBindTemporaryExpr(<wbr>CXXBindTemporaryExpr *E);<br>
   void VisitCXXConstructExpr(const CXXConstructExpr *E);<br>
+  void VisitCXXInheritedCtorInitExpr(<wbr>const CXXInheritedCtorInitExpr *E);<br>
   void VisitLambdaExpr(LambdaExpr *E);<br>
   void VisitCXXStdInitializerListExpr<wbr>(CXXStdInitializerListExpr *E);<br>
   void VisitExprWithCleanups(<wbr>ExprWithCleanups *E);<br>
@@ -998,6 +999,14 @@ AggExprEmitter::<wbr>VisitCXXConstructExpr(co<br>
   CGF.EmitCXXConstructExpr(E, Slot);<br>
 }<br>
<br>
+void AggExprEmitter::<wbr>VisitCXXInheritedCtorInitExpr(<br>
+    const CXXInheritedCtorInitExpr *E) {<br>
+  AggValueSlot Slot = EnsureSlot(E->getType());<br>
+  CGF.<wbr>EmitInheritedCXXConstructorCal<wbr>l(<br>
+      E->getConstructor(), E->constructsVBase(), Slot.getAddress(),<br>
+      E->inheritedFromVBase(), E);<br>
+}<br>
+<br>
 void<br>
 AggExprEmitter::<wbr>VisitLambdaExpr(LambdaExpr *E) {<br>
   AggValueSlot Slot = EnsureSlot(E->getType());<br>
<br>
Modified: cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.cpp?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.cpp Tue Jun 28 14:03:57 2016<br>
@@ -928,18 +928,11 @@ static void TryMarkNoThrow(llvm::Functio<br>
   F->setDoesNotThrow();<br>
 }<br>
<br>
-void CodeGenFunction::GenerateCode(<wbr>GlobalDecl GD, llvm::Function *Fn,<br>
-                                   const CGFunctionInfo &FnInfo) {<br>
+QualType CodeGenFunction::<wbr>BuildFunctionArgList(<wbr>GlobalDecl GD,<br>
+                                               FunctionArgList &Args) {<br>
   const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl(<wbr>));<br>
-<br>
-  // Check if we should generate debug info for this function.<br>
-  if (FD->hasAttr<NoDebugAttr>())<br>
-    DebugInfo = nullptr; // disable debug info indefinitely for this function<br>
-<br>
-  FunctionArgList Args;<br>
   QualType ResTy = FD->getReturnType();<br>
<br>
-  CurGD = GD;<br>
   const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD);<br>
   if (MD && MD->isInstance()) {<br>
     if (CGM.getCXXABI().<wbr>HasThisReturn(GD))<br>
@@ -949,22 +942,48 @@ void CodeGenFunction::GenerateCode(<wbr>Globa<br>
     CGM.getCXXABI().<wbr>buildThisParam(*this, Args);<br>
   }<br>
<br>
-  for (auto *Param : FD->parameters()) {<br>
-    Args.push_back(Param);<br>
-    if (!Param->hasAttr<<wbr>PassObjectSizeAttr>())<br>
-      continue;<br>
-<br>
-    IdentifierInfo *NoID = nullptr;<br>
-    auto *Implicit = ImplicitParamDecl::Create(<br>
-        getContext(), Param->getDeclContext(), Param->getLocation(), NoID,<br>
-        getContext().getSizeType());<br>
-    SizeArguments[Param] = Implicit;<br>
-    Args.push_back(Implicit);<br>
+  // The base version of an inheriting constructor whose constructed base is a<br>
+  // virtual base is not passed any arguments (because it doesn't actually call<br>
+  // the inherited constructor).<br>
+  bool PassedParams = true;<br>
+  if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(<wbr>FD))<br>
+    if (auto Inherited = CD->getInheritedConstructor())<br>
+      PassedParams =<br>
+          getTypes().<wbr>inheritingCtorHasParams(<wbr>Inherited, GD.getCtorType());<br>
+<br>
+  if (PassedParams) {<br>
+    for (auto *Param : FD->parameters()) {<br>
+      Args.push_back(Param);<br>
+      if (!Param->hasAttr<<wbr>PassObjectSizeAttr>())<br>
+        continue;<br>
+<br>
+      IdentifierInfo *NoID = nullptr;<br>
+      auto *Implicit = ImplicitParamDecl::Create(<br>
+          getContext(), Param->getDeclContext(), Param->getLocation(), NoID,<br>
+          getContext().getSizeType());<br>
+      SizeArguments[Param] = Implicit;<br>
+      Args.push_back(Implicit);<br>
+    }<br>
   }<br>
<br>
   if (MD && (isa<CXXConstructorDecl>(MD) || isa<CXXDestructorDecl>(MD)))<br>
     CGM.getCXXABI().<wbr>addImplicitStructorParams(*<wbr>this, ResTy, Args);<br>
<br>
+  return ResTy;<br>
+}<br>
+<br>
+void CodeGenFunction::GenerateCode(<wbr>GlobalDecl GD, llvm::Function *Fn,<br>
+                                   const CGFunctionInfo &FnInfo) {<br>
+  const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl(<wbr>));<br>
+  CurGD = GD;<br>
+<br>
+  FunctionArgList Args;<br>
+  QualType ResTy = BuildFunctionArgList(GD, Args);<br>
+<br>
+  // Check if we should generate debug info for this function.<br>
+  if (FD->hasAttr<NoDebugAttr>())<br>
+    DebugInfo = nullptr; // disable debug info indefinitely for this function<br>
+<br>
   SourceRange BodyRange;<br>
   if (Stmt *Body = FD->getBody()) BodyRange = Body->getSourceRange();<br>
   CurEHLocation = BodyRange.getEnd();<br>
<br>
Modified: cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.h?rev=274049&<wbr>r1=274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.h (original)<br>
+++ cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.h Tue Jun 28 14:03:57 2016<br>
@@ -1065,6 +1065,61 @@ public:<br>
     CharUnits OldCXXThisAlignment;<br>
   };<br>
<br>
+  class InlinedInheritingConstructorSc<wbr>ope {<br>
+  public:<br>
+    InlinedInheritingConstructorSc<wbr>ope(CodeGenFunction &CGF, GlobalDecl GD)<br>
+        : CGF(CGF), OldCurGD(CGF.CurGD), OldCurFuncDecl(CGF.<wbr>CurFuncDecl),<br>
+          OldCurCodeDecl(CGF.<wbr>CurCodeDecl),<br>
+          OldCXXABIThisDecl(CGF.<wbr>CXXABIThisDecl),<br>
+          OldCXXABIThisValue(CGF.<wbr>CXXABIThisValue),<br>
+          OldCXXThisValue(CGF.<wbr>CXXThisValue),<br>
+          OldCXXABIThisAlignment(CGF.<wbr>CXXABIThisAlignment),<br>
+          OldCXXThisAlignment(CGF.<wbr>CXXThisAlignment),<br>
+          OldReturnValue(CGF.<wbr>ReturnValue), OldFnRetTy(CGF.FnRetTy),<br>
+          OldCXXInheritedCtorInitExprArg<wbr>s(<br>
+              std::move(CGF.<wbr>CXXInheritedCtorInitExprArgs)) {<br>
+      CGF.CurGD = GD;<br>
+      CGF.CurFuncDecl = CGF.CurCodeDecl =<br>
+          cast<CXXConstructorDecl>(GD.<wbr>getDecl());<br>
+      CGF.CXXABIThisDecl = nullptr;<br>
+      CGF.CXXABIThisValue = nullptr;<br>
+      CGF.CXXThisValue = nullptr;<br>
+      CGF.CXXABIThisAlignment = CharUnits();<br>
+      CGF.CXXThisAlignment = CharUnits();<br>
+      CGF.ReturnValue = Address::invalid();<br>
+      CGF.FnRetTy = QualType();<br>
+      CGF.<wbr>CXXInheritedCtorInitExprArgs.<wbr>clear();<br>
+    }<br>
+    ~<wbr>InlinedInheritingConstructorSc<wbr>ope() {<br>
+      CGF.CurGD = OldCurGD;<br>
+      CGF.CurFuncDecl = OldCurFuncDecl;<br>
+      CGF.CurCodeDecl = OldCurCodeDecl;<br>
+      CGF.CXXABIThisDecl = OldCXXABIThisDecl;<br>
+      CGF.CXXABIThisValue = OldCXXABIThisValue;<br>
+      CGF.CXXThisValue = OldCXXThisValue;<br>
+      CGF.CXXABIThisAlignment = OldCXXABIThisAlignment;<br>
+      CGF.CXXThisAlignment = OldCXXThisAlignment;<br>
+      CGF.ReturnValue = OldReturnValue;<br>
+      CGF.FnRetTy = OldFnRetTy;<br>
+      CGF.<wbr>CXXInheritedCtorInitExprArgs =<br>
+          std::move(<wbr>OldCXXInheritedCtorInitExprArg<wbr>s);<br>
+    }<br>
+<br>
+  private:<br>
+    CodeGenFunction &CGF;<br>
+    GlobalDecl OldCurGD;<br>
+    const Decl *OldCurFuncDecl;<br>
+    const Decl *OldCurCodeDecl;<br>
+    ImplicitParamDecl *OldCXXABIThisDecl;<br>
+    llvm::Value *OldCXXABIThisValue;<br>
+    llvm::Value *OldCXXThisValue;<br>
+    CharUnits OldCXXABIThisAlignment;<br>
+    CharUnits OldCXXThisAlignment;<br>
+    Address OldReturnValue;<br>
+    QualType OldFnRetTy;<br>
+    CallArgList OldCXXInheritedCtorInitExprArg<wbr>s;<br>
+  };<br>
+<br>
 private:<br>
   /// CXXThisDecl - When generating code for a C++ member function,<br>
   /// this will hold the implicit 'this' declaration.<br>
@@ -1078,6 +1133,10 @@ private:<br>
   /// this expression.<br>
   Address CXXDefaultInitExprThis = Address::invalid();<br>
<br>
+  /// The values of function arguments to use when evaluating<br>
+  /// CXXInheritedCtorInitExprs within this context.<br>
+  CallArgList CXXInheritedCtorInitExprArgs;<br>
+<br>
   /// CXXStructorImplicitParamDecl - When generating code for a constructor or<br>
   /// destructor, this will hold the implicit argument (e.g. VTT).<br>
   ImplicitParamDecl *CXXStructorImplicitParamDecl;<br>
@@ -1301,6 +1360,8 @@ public:<br>
<br>
   const BlockByrefInfo &getBlockByrefInfo(const VarDecl *var);<br>
<br>
+  QualType BuildFunctionArgList(<wbr>GlobalDecl GD, FunctionArgList &Args);<br>
+<br>
   void GenerateCode(GlobalDecl GD, llvm::Function *Fn,<br>
                     const CGFunctionInfo &FnInfo);<br>
   /// \brief Emit code for the start of a function.<br>
@@ -1874,10 +1935,32 @@ public:<br>
   void EmitDelegatingCXXConstructorCa<wbr>ll(const CXXConstructorDecl *Ctor,<br>
                                         const FunctionArgList &Args);<br>
<br>
+  /// Emit a call to an inheriting constructor (that is, one that invokes a<br>
+  /// constructor inherited from a base class) by inlining its definition. This<br>
+  /// is necessary if the ABI does not support forwarding the arguments to the<br>
+  /// base class constructor (because they're variadic or similar).<br>
+  void EmitInlinedInheritingCXXConstr<wbr>uctorCall(const CXXConstructorDecl *Ctor,<br>
+                                               CXXCtorType CtorType,<br>
+                                               bool ForVirtualBase,<br>
+                                               bool Delegating,<br>
+                                               CallArgList &Args);<br>
+<br>
+  /// Emit a call to a constructor inherited from a base class, passing the<br>
+  /// current constructor's arguments along unmodified (without even making<br>
+  /// a copy).<br>
+  void EmitInheritedCXXConstructorCal<wbr>l(const CXXConstructorDecl *D,<br>
+                                       bool ForVirtualBase, Address This,<br>
+                                       bool InheritedFromVBase,<br>
+                                       const CXXInheritedCtorInitExpr *E);<br>
+<br>
   void EmitCXXConstructorCall(const CXXConstructorDecl *D, CXXCtorType Type,<br>
                               bool ForVirtualBase, bool Delegating,<br>
                               Address This, const CXXConstructExpr *E);<br>
<br>
+  void EmitCXXConstructorCall(const CXXConstructorDecl *D, CXXCtorType Type,<br>
+                              bool ForVirtualBase, bool Delegating,<br>
+                              Address This, CallArgList &Args);<br>
+<br>
   /// Emit assumption load for all bases. Requires to be be called only on<br>
   /// most-derived class and not under construction of the object.<br>
   void EmitVTableAssumptionLoads(<wbr>const CXXRecordDecl *ClassDecl, Address This);<br>
<br>
Modified: cfe/trunk/lib/CodeGen/<wbr>CodeGenModule.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>CodeGenModule.cpp?rev=274049&<wbr>r1=274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/CodeGen/<wbr>CodeGenModule.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/<wbr>CodeGenModule.cpp Tue Jun 28 14:03:57 2016<br>
@@ -765,6 +765,15 @@ CodeGenModule::<wbr>getFunctionLinkage(Global<br>
                                    : llvm::GlobalValue::<wbr>LinkOnceODRLinkage;<br>
   }<br>
<br>
+  if (isa<CXXConstructorDecl>(D) &&<br>
+      cast<CXXConstructorDecl>(D)-><wbr>isInheritingConstructor() &&<br>
+      Context.getTargetInfo().<wbr>getCXXABI().isMicrosoft()) {<br>
+    // Our approach to inheriting constructors is fundamentally different from<br>
+    // that used by the MS ABI, so keep our inheriting constructor thunks<br>
+    // internal rather than trying to pick an unambiguous mangling for them.<br>
+    return llvm::GlobalValue::<wbr>InternalLinkage;<br>
+  }<br>
+<br>
   return getLLVMLinkageForDeclarator(D, Linkage, /*isConstantVariable=*/false);<br>
 }<br>
<br>
<br>
Modified: cfe/trunk/lib/CodeGen/<wbr>CodeGenTypes.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>CodeGenTypes.h?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/CodeGen/<wbr>CodeGenTypes.h (original)<br>
+++ cfe/trunk/lib/CodeGen/<wbr>CodeGenTypes.h Tue Jun 28 14:03:57 2016<br>
@@ -205,6 +205,11 @@ public:<br>
   bool isFuncTypeConvertible(const FunctionType *FT);<br>
   bool isFuncParamTypeConvertible(<wbr>QualType Ty);<br>
<br>
+  /// Determine if a C++ inheriting constructor should have parameters matching<br>
+  /// those of its inherited constructor.<br>
+  bool inheritingCtorHasParams(const InheritedConstructor &Inherited,<br>
+                               CXXCtorType Type);<br>
+<br>
   /// GetFunctionTypeForVTable - Get the LLVM function type for use in a vtable,<br>
   /// given a CXXMethodDecl. If the method to has an incomplete return type,<br>
   /// and/or incomplete argument types, this will return the opaque type.<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaAccess.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaAccess.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/SemaAccess.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaAccess.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -1610,10 +1610,10 @@ Sema::AccessResult Sema::CheckDestructor<br>
 /// Checks access to a constructor.<br>
 Sema::AccessResult Sema::CheckConstructorAccess(<wbr>SourceLocation UseLoc,<br>
                                                 CXXConstructorDecl *Constructor,<br>
+                                                DeclAccessPair Found,<br>
                                                 const InitializedEntity &Entity,<br>
-                                                AccessSpecifier Access,<br>
                                                 bool IsCopyBindingRefToTemp) {<br>
-  if (!getLangOpts().AccessControl || Access == AS_public)<br>
+  if (!getLangOpts().AccessControl || Found.getAccess() == AS_public)<br>
     return AR_accessible;<br>
<br>
   PartialDiagnostic PD(PDiag());<br>
@@ -1647,17 +1647,17 @@ Sema::AccessResult Sema::CheckConstructo<br>
<br>
   }<br>
<br>
-  return CheckConstructorAccess(UseLoc, Constructor, Entity, Access, PD);<br>
+  return CheckConstructorAccess(UseLoc, Constructor, Found, Entity, PD);<br>
 }<br>
<br>
 /// Checks access to a constructor.<br>
 Sema::AccessResult Sema::CheckConstructorAccess(<wbr>SourceLocation UseLoc,<br>
                                                 CXXConstructorDecl *Constructor,<br>
+                                                DeclAccessPair Found,<br>
                                                 const InitializedEntity &Entity,<br>
-                                                AccessSpecifier Access,<br>
                                                 const PartialDiagnostic &PD) {<br>
   if (!getLangOpts().AccessControl ||<br>
-      Access == AS_public)<br>
+      Found.getAccess() == AS_public)<br>
     return AR_accessible;<br>
<br>
   CXXRecordDecl *NamingClass = Constructor->getParent();<br>
@@ -1670,15 +1670,23 @@ Sema::AccessResult Sema::CheckConstructo<br>
   // in aggregate initialization. It's not clear whether the object class<br>
   // should be the base class or the derived class in that case.<br>
   CXXRecordDecl *ObjectClass;<br>
-  if (Entity.getKind() == InitializedEntity::EK_Base && !Entity.getParent()) {<br>
+  if ((Entity.getKind() == InitializedEntity::EK_Base ||<br>
+       Entity.getKind() == InitializedEntity::EK_<wbr>Delegating) &&<br>
+      !Entity.getParent()) {<br>
     ObjectClass = cast<CXXConstructorDecl>(<wbr>CurContext)->getParent();<br>
+  } else if (auto *Shadow =<br>
+                 dyn_cast<<wbr>ConstructorUsingShadowDecl>(<wbr>Found.getDecl())) {<br>
+    // If we're using an inheriting constructor to construct an object,<br>
+    // the object class is the derived class, not the base class.<br>
+    ObjectClass = Shadow->getParent();<br>
   } else {<br>
     ObjectClass = NamingClass;<br>
   }<br>
<br>
-  AccessTarget AccessEntity(Context, AccessTarget::Member, NamingClass,<br>
-                            DeclAccessPair::make(<wbr>Constructor, Access),<br>
-                            Context.getTypeDeclType(<wbr>ObjectClass));<br>
+  AccessTarget AccessEntity(<br>
+      Context, AccessTarget::Member, NamingClass,<br>
+      DeclAccessPair::make(<wbr>Constructor, Found.getAccess()),<br>
+      Context.getTypeDeclType(<wbr>ObjectClass));<br>
   AccessEntity.setDiag(PD);<br>
<br>
   return CheckAccess(*this, UseLoc, AccessEntity);<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaDeclCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaDeclCXX.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaDeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaDeclCXX.cpp Tue Jun 28 14:03:57 2016<br>
@@ -3356,34 +3356,7 @@ BuildImplicitBaseInitializer(<wbr>Sema &SemaR<br>
   ExprResult BaseInit;<br>
<br>
   switch (ImplicitInitKind) {<br>
-  case IIK_Inherit: {<br>
-    const CXXRecordDecl *Inherited =<br>
-        Constructor-><wbr>getInheritedConstructor()-><wbr>getParent();<br>
-    const CXXRecordDecl *Base = BaseSpec->getType()-><wbr>getAsCXXRecordDecl();<br>
-    if (Base && Inherited->getCanonicalDecl() == Base->getCanonicalDecl()) {<br>
-      // C++11 [class.inhctor]p8:<br>
-      //   Each expression in the expression-list is of the form<br>
-      //   static_cast<T&&>(p), where p is the name of the corresponding<br>
-      //   constructor parameter and T is the declared type of p.<br>
-      SmallVector<Expr*, 16> Args;<br>
-      for (unsigned I = 0, E = Constructor->getNumParams(); I != E; ++I) {<br>
-        ParmVarDecl *PD = Constructor->getParamDecl(I);<br>
-        ExprResult ArgExpr =<br>
-            SemaRef.BuildDeclRefExpr(PD, PD->getType().<wbr>getNonReferenceType(),<br>
-                                     VK_LValue, SourceLocation());<br>
-        if (ArgExpr.isInvalid())<br>
-          return true;<br>
-        Args.push_back(CastForMoving(<wbr>SemaRef, ArgExpr.get(), PD->getType()));<br>
-      }<br>
-<br>
-      InitializationKind InitKind = InitializationKind::<wbr>CreateDirect(<br>
-          Constructor->getLocation(), SourceLocation(), SourceLocation());<br>
-      InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, Args);<br>
-      BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, Args);<br>
-      break;<br>
-    }<br>
-  }<br>
-  // Fall through.<br>
+  case IIK_Inherit:<br>
   case IIK_Default: {<br>
     InitializationKind InitKind<br>
       = InitializationKind::<wbr>CreateDefault(Constructor-><wbr>getLocation());<br>
@@ -3694,12 +3667,12 @@ struct BaseAndFieldInfo {<br>
   BaseAndFieldInfo(Sema &S, CXXConstructorDecl *Ctor, bool ErrorsInInits)<br>
     : S(S), Ctor(Ctor), AnyErrorsInInits(<wbr>ErrorsInInits) {<br>
     bool Generated = Ctor->isImplicit() || Ctor->isDefaulted();<br>
-    if (Generated && Ctor->isCopyConstructor())<br>
+    if (Ctor-><wbr>getInheritedConstructor())<br>
+      IIK = IIK_Inherit;<br>
+    else if (Generated && Ctor->isCopyConstructor())<br>
       IIK = IIK_Copy;<br>
     else if (Generated && Ctor->isMoveConstructor())<br>
       IIK = IIK_Move;<br>
-    else if (Ctor-><wbr>getInheritedConstructor())<br>
-      IIK = IIK_Inherit;<br>
     else<br>
       IIK = IIK_Default;<br>
   }<br>
@@ -5065,15 +5038,6 @@ void Sema::CheckCompletedCXXClass(<wbr>CXXRec<br>
     Diag(Record->getLocation(), diag::warn_cxx_ms_struct);<br>
   }<br>
<br>
-  // Declare inheriting constructors. We do this eagerly here because:<br>
-  // - The standard requires an eager diagnostic for conflicting inheriting<br>
-  //   constructors from different classes.<br>
-  // - The lazy declaration of the other implicit constructors is so as to not<br>
-  //   waste space and performance on classes that are not meant to be<br>
-  //   instantiated (e.g. meta-functions). This doesn't apply to classes that<br>
-  //   have inheriting constructors.<br>
-  DeclareInheritingConstructors(<wbr>Record);<br>
-<br>
   checkClassLevelDLLAttribute(<wbr>Record);<br>
 }<br>
<br>
@@ -5107,11 +5071,110 @@ static Sema::<wbr>SpecialMemberOverloadResult<br>
                                LHSQuals & Qualifiers::Volatile);<br>
 }<br>
<br>
+namespace {<br>
+struct InheritedConstructorInfo {<br>
+  Sema &S;<br>
+  SourceLocation UseLoc;<br>
+  ConstructorUsingShadowDecl *Shadow;<br>
+<br>
+  /// A mapping from the base classes through which the constructor was<br>
+  /// inherited to the using shadow declaration in that base class (or a null<br>
+  /// pointer if the constructor was declared in that base class).<br>
+  llvm::DenseMap<CXXRecordDecl *, ConstructorUsingShadowDecl *><br>
+      InheritedFromBases;<br>
+<br>
+  InheritedConstructorInfo(Sema &S, SourceLocation UseLoc,<br>
+                           ConstructorUsingShadowDecl *Shadow)<br>
+      : S(S), UseLoc(UseLoc), Shadow(Shadow) {<br>
+    bool DiagnosedMultipleConstructedBa<wbr>ses = false;<br>
+    CXXRecordDecl *ConstructedBase = nullptr;<br>
+    UsingDecl *ConstructedBaseUsing = nullptr;<br>
+<br>
+    // Find the set of such base class subobjects and check that there's a<br>
+    // unique constructed subobject.<br>
+    for (auto *D : Shadow->redecls()) {<br>
+      auto *DShadow = cast<<wbr>ConstructorUsingShadowDecl>(D)<wbr>;<br>
+      auto *DNominatedBase = DShadow-><wbr>getNominatedBaseClass();<br>
+      auto *DConstructedBase = DShadow-><wbr>getConstructedBaseClass();<br>
+<br>
+      InheritedFromBases.insert(<br>
+          std::make_pair(DNominatedBase-<wbr>>getCanonicalDecl(),<br>
+                         DShadow-><wbr>getNominatedBaseClassShadowDec<wbr>l()));<br>
+      if (DShadow-><wbr>constructsVirtualBase())<br>
+        InheritedFromBases.insert(<br>
+            std::make_pair(<wbr>DConstructedBase-><wbr>getCanonicalDecl(),<br>
+                           DShadow-><wbr>getConstructedBaseClassShadowD<wbr>ecl()));<br>
+      else<br>
+        assert(DNominatedBase == DConstructedBase);<br>
+<br>
+      // [class.inhctor.init]p2:<br>
+      //   If the constructor was inherited from multiple base class subobjects<br>
+      //   of type B, the program is ill-formed.<br>
+      if (!ConstructedBase) {<br>
+        ConstructedBase = DConstructedBase;<br>
+        ConstructedBaseUsing = D->getUsingDecl();<br>
+      } else if (ConstructedBase != DConstructedBase &&<br>
+                 !Shadow->isInvalidDecl()) {<br>
+        if (!<wbr>DiagnosedMultipleConstructedBa<wbr>ses) {<br>
+          S.Diag(UseLoc, diag::err_ambiguous_inherited_<wbr>constructor)<br>
+              << Shadow->getTargetDecl();<br>
+          S.Diag(ConstructedBaseUsing-><wbr>getLocation(),<br>
+               diag::note_ambiguous_<wbr>inherited_constructor_using)<br>
+              << ConstructedBase;<br>
+          DiagnosedMultipleConstructedBa<wbr>ses = true;<br>
+        }<br>
+        S.Diag(D->getUsingDecl()-><wbr>getLocation(),<br>
+               diag::note_ambiguous_<wbr>inherited_constructor_using)<br>
+            << DConstructedBase;<br>
+      }<br>
+    }<br>
+<br>
+    if (<wbr>DiagnosedMultipleConstructedBa<wbr>ses)<br>
+      Shadow->setInvalidDecl();<br>
+  }<br>
+<br>
+  /// Find the constructor to use for inherited construction of a base class,<br>
+  /// and whether that base class constructor inherits the constructor from a<br>
+  /// virtual base class (in which case it won't actually invoke it).<br>
+  std::pair<CXXConstructorDecl *, bool><br>
+  findConstructorForBase(<wbr>CXXRecordDecl *Base, CXXConstructorDecl *Ctor) const {<br>
+    auto It = InheritedFromBases.find(Base-><wbr>getCanonicalDecl());<br>
+    if (It == InheritedFromBases.end())<br>
+      return std::make_pair(nullptr, false);<br>
+<br>
+    // This is an intermediary class.<br>
+    if (It->second)<br>
+      return std::make_pair(<br>
+          S.findInheritingConstructor(<wbr>UseLoc, Ctor, It->second),<br>
+          It->second-><wbr>constructsVirtualBase());<br>
+<br>
+    // This is the base class from which the constructor was inherited.<br>
+    return std::make_pair(Ctor, false);<br>
+  }<br>
+};<br>
+}<br>
+<br>
 /// Is the special member function which would be selected to perform the<br>
 /// specified operation on the specified class type a constexpr constructor?<br>
-static bool specialMemberIsConstexpr(Sema &S, CXXRecordDecl *ClassDecl,<br>
-                                     Sema::CXXSpecialMember CSM,<br>
-                                     unsigned Quals, bool ConstRHS) {<br>
+static bool<br>
+specialMemberIsConstexpr(Sema &S, CXXRecordDecl *ClassDecl,<br>
+                         Sema::CXXSpecialMember CSM, unsigned Quals,<br>
+                         bool ConstRHS,<br>
+                         CXXConstructorDecl *InheritedCtor = nullptr,<br>
+                         InheritedConstructorInfo *Inherited = nullptr) {<br>
+  // If we're inheriting a constructor, see if we need to call it for this base<br>
+  // class.<br>
+  if (InheritedCtor) {<br>
+    assert(CSM == Sema::CXXDefaultConstructor);<br>
+    auto BaseCtor =<br>
+        Inherited-><wbr>findConstructorForBase(<wbr>ClassDecl, InheritedCtor).first;<br>
+    if (BaseCtor)<br>
+      return BaseCtor->isConstexpr();<br>
+  }<br>
+<br>
+  if (CSM == Sema::CXXDefaultConstructor)<br>
+    return ClassDecl-><wbr>hasConstexprDefaultConstructor<wbr>();<br>
+<br>
   Sema::<wbr>SpecialMemberOverloadResult *SMOR =<br>
       lookupCallFromSpecialMember(S, ClassDecl, CSM, Quals, ConstRHS);<br>
   if (!SMOR || !SMOR->getMethod())<br>
@@ -5123,9 +5186,10 @@ static bool specialMemberIsConstexpr(Sem<br>
<br>
 /// Determine whether the specified special member function would be constexpr<br>
 /// if it were implicitly defined.<br>
-static bool defaultedSpecialMemberIsConste<wbr>xpr(Sema &S, CXXRecordDecl *ClassDecl,<br>
-                                              Sema::CXXSpecialMember CSM,<br>
-                                              bool ConstArg) {<br>
+static bool defaultedSpecialMemberIsConste<wbr>xpr(<br>
+    Sema &S, CXXRecordDecl *ClassDecl, Sema::CXXSpecialMember CSM,<br>
+    bool ConstArg, CXXConstructorDecl *InheritedCtor = nullptr,<br>
+    InheritedConstructorInfo *Inherited = nullptr) {<br>
   if (!S.getLangOpts().CPlusPlus11)<br>
     return false;<br>
<br>
@@ -5134,6 +5198,8 @@ static bool defaultedSpecialMemberIsCons<br>
   bool Ctor = true;<br>
   switch (CSM) {<br>
   case Sema::CXXDefaultConstructor:<br>
+    if (Inherited)<br>
+      break;<br>
     // Since default constructor lookup is essentially trivial (and cannot<br>
     // involve, for instance, template instantiation), we compute whether a<br>
     // defaulted default constructor is constexpr directly within CXXRecordDecl.<br>
@@ -5168,7 +5234,10 @@ static bool defaultedSpecialMemberIsCons<br>
   // will be initialized (if the constructor isn't deleted), we just don't know<br>
   // which one.<br>
   if (Ctor && ClassDecl->isUnion())<br>
-    return true;<br>
+    return CSM == Sema::CXXDefaultConstructor<br>
+               ? ClassDecl-><wbr>hasInClassInitializer() ||<br>
+                     !ClassDecl->hasVariantMembers(<wbr>)<br>
+               : true;<br>
<br>
   //   -- the class shall not have any virtual base classes;<br>
   if (Ctor && ClassDecl->getNumVBases())<br>
@@ -5188,7 +5257,8 @@ static bool defaultedSpecialMemberIsCons<br>
     if (!BaseType) continue;<br>
<br>
     CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseType-><wbr>getDecl());<br>
-    if (!specialMemberIsConstexpr(S, BaseClassDecl, CSM, 0, ConstArg))<br>
+    if (!specialMemberIsConstexpr(S, BaseClassDecl, CSM, 0, ConstArg,<br>
+                                  InheritedCtor, Inherited))<br>
       return false;<br>
   }<br>
<br>
@@ -5202,6 +5272,8 @@ static bool defaultedSpecialMemberIsCons<br>
   for (const auto *F : ClassDecl->fields()) {<br>
     if (F->isInvalidDecl())<br>
       continue;<br>
+    if (CSM == Sema::CXXDefaultConstructor && F->hasInClassInitializer())<br>
+      continue;<br>
     QualType BaseType = S.Context.getBaseElementType(<wbr>F->getType());<br>
     if (const RecordType *RecordTy = BaseType->getAs<RecordType>()) {<br>
       CXXRecordDecl *FieldRecDecl = cast<CXXRecordDecl>(RecordTy-><wbr>getDecl());<br>
@@ -5209,6 +5281,8 @@ static bool defaultedSpecialMemberIsCons<br>
                                     BaseType.getCVRQualifiers(),<br>
                                     ConstArg && !F->isMutable()))<br>
         return false;<br>
+    } else if (CSM == Sema::CXXDefaultConstructor) {<br>
+      return false;<br>
     }<br>
   }<br>
<br>
@@ -5236,7 +5310,8 @@ computeImplicitExceptionSpec(<wbr>Sema &S, So<br>
   }<br>
   assert(cast<<wbr>CXXConstructorDecl>(MD)-><wbr>getInheritedConstructor() &&<br>
          "only special members have implicit exception specs");<br>
-  return S.<wbr>ComputeInheritingCtorException<wbr>Spec(cast<CXXConstructorDecl>(<wbr>MD));<br>
+  return S.<wbr>ComputeInheritingCtorException<wbr>Spec(Loc,<br>
+                                              cast<CXXConstructorDecl>(MD));<br>
 }<br>
<br>
 static FunctionProtoType::<wbr>ExtProtoInfo getImplicitMethodEPI(Sema &S,<br>
@@ -6501,14 +6576,12 @@ void Sema::<wbr>ActOnFinishCXXMemberSpecifica<br>
 /// [special]p1).  This routine can only be executed just before the<br>
 /// definition of the class is complete.<br>
 void Sema::<wbr>AddImplicitlyDeclaredMembersTo<wbr>Class(CXXRecordDecl *ClassDecl) {<br>
-  if (!ClassDecl-><wbr>hasUserDeclaredConstructor())<br>
+  if (ClassDecl-><wbr>needsImplicitDefaultConstructo<wbr>r()) {<br>
     ++ASTContext::<wbr>NumImplicitDefaultConstructors<wbr>;<br>
<br>
-  // If this class inherited any constructors, declare the default constructor<br>
-  // now in case it displaces one from a base class.<br>
-  if (ClassDecl-><wbr>needsImplicitDefaultConstructo<wbr>r() &&<br>
-      ClassDecl-><wbr>hasInheritedConstructor())<br>
-    DeclareImplicitDefaultConstruc<wbr>tor(ClassDecl);<br>
+    if (ClassDecl-><wbr>hasInheritedConstructor())<br>
+      DeclareImplicitDefaultConstruc<wbr>tor(ClassDecl);<br>
+  }<br>
<br>
   if (ClassDecl-><wbr>needsImplicitCopyConstructor()<wbr>) {<br>
     ++ASTContext::<wbr>NumImplicitCopyConstructors;<br>
@@ -7928,12 +8001,21 @@ bool Sema::CheckUsingShadowDecl(<wbr>UsingDec<br>
   return true;<br>
 }<br>
<br>
+/// Determine whether a direct base class is a virtual base class.<br>
+static bool isVirtualDirectBase(<wbr>CXXRecordDecl *Derived, CXXRecordDecl *Base) {<br>
+  if (!Derived->getNumVBases())<br>
+    return false;<br>
+  for (auto &B : Derived->bases())<br>
+    if (B.getType()-><wbr>getAsCXXRecordDecl() == Base)<br>
+      return B.isVirtual();<br>
+  llvm_unreachable("not a direct base class");<br>
+}<br>
+<br>
 /// Builds a shadow declaration corresponding to a 'using' declaration.<br>
 UsingShadowDecl *Sema::BuildUsingShadowDecl(<wbr>Scope *S,<br>
                                             UsingDecl *UD,<br>
                                             NamedDecl *Orig,<br>
                                             UsingShadowDecl *PrevDecl) {<br>
-<br>
   // If we resolved to another shadow declaration, just coalesce them.<br>
   NamedDecl *Target = Orig;<br>
   if (isa<UsingShadowDecl>(Target)) {<br>
@@ -7941,9 +8023,21 @@ UsingShadowDecl *Sema::BuildUsingShadowD<br>
     assert(!isa<UsingShadowDecl>(<wbr>Target) && "nested shadow declaration");<br>
   }<br>
<br>
-  UsingShadowDecl *Shadow<br>
-    = UsingShadowDecl::Create(<wbr>Context, CurContext,<br>
-                              UD->getLocation(), UD, Target);<br>
+  NamedDecl *NonTemplateTarget = Target;<br>
+  if (auto *TargetTD = dyn_cast<TemplateDecl>(Target)<wbr>)<br>
+    NonTemplateTarget = TargetTD->getTemplatedDecl();<br>
+<br>
+  UsingShadowDecl *Shadow;<br>
+  if (isa<CXXConstructorDecl>(<wbr>NonTemplateTarget)) {<br>
+    bool IsVirtualBase =<br>
+        isVirtualDirectBase(cast<<wbr>CXXRecordDecl>(CurContext),<br>
+                            UD->getQualifier()-><wbr>getAsRecordDecl());<br>
+    Shadow = ConstructorUsingShadowDecl::<wbr>Create(<br>
+        Context, CurContext, UD->getLocation(), UD, Orig, IsVirtualBase);<br>
+  } else {<br>
+    Shadow = UsingShadowDecl::Create(<wbr>Context, CurContext, UD->getLocation(), UD,<br>
+                                     Target);<br>
+  }<br>
   UD->addShadowDecl(Shadow);<br>
<br>
   Shadow->setAccess(UD-><wbr>getAccess());<br>
@@ -8128,8 +8222,17 @@ NamedDecl *Sema::BuildUsingDeclaration(S<br>
     return nullptr;<br>
   }<br>
<br>
+  // For an inheriting constructor declaration, the name of the using<br>
+  // declaration is the name of a constructor in this class, not in the<br>
+  // base class.<br>
+  DeclarationNameInfo UsingName = NameInfo;<br>
+  if (UsingName.getName().<wbr>getNameKind() == DeclarationName::<wbr>CXXConstructorName)<br>
+    if (auto *RD = dyn_cast<CXXRecordDecl>(<wbr>CurContext))<br>
+      UsingName.setName(Context.<wbr>DeclarationNames.<wbr>getCXXConstructorName(<br>
+          Context.getCanonicalType(<wbr>Context.getRecordType(RD))));<br>
+<br>
   // Do the redeclaration lookup in the current scope.<br>
-  LookupResult Previous(*this, NameInfo, LookupUsingDeclName,<br>
+  LookupResult Previous(*this, UsingName, LookupUsingDeclName,<br>
                         ForRedeclaration);<br>
   Previous.setHideTags(false);<br>
   if (S) {<br>
@@ -8186,8 +8289,8 @@ NamedDecl *Sema::BuildUsingDeclaration(S<br>
<br>
   auto Build = [&](bool Invalid) {<br>
     UsingDecl *UD =<br>
-        UsingDecl::Create(Context, CurContext, UsingLoc, QualifierLoc, NameInfo,<br>
-                          HasTypenameKeyword);<br>
+        UsingDecl::Create(Context, CurContext, UsingLoc, QualifierLoc,<br>
+                          UsingName, HasTypenameKeyword);<br>
     UD->setAccess(AS);<br>
     CurContext->addDecl(UD);<br>
     UD->setInvalidDecl(Invalid);<br>
@@ -8242,6 +8345,9 @@ NamedDecl *Sema::BuildUsingDeclaration(S<br>
       // If we corrected to an inheriting constructor, handle it as one.<br>
       auto *RD = dyn_cast<CXXRecordDecl>(ND);<br>
       if (RD && RD->isInjectedClassName()) {<br>
+        // The parent of the injected class name is the class itself.<br>
+        RD = cast<CXXRecordDecl>(RD-><wbr>getParent());<br>
+<br>
         // Fix up the information we'll use to build the using declaration.<br>
         if (Corrected.<wbr>WillReplaceSpecifier()) {<br>
           NestedNameSpecifierLocBuilder Builder;<br>
@@ -8250,14 +8356,19 @@ NamedDecl *Sema::BuildUsingDeclaration(S<br>
           QualifierLoc = Builder.getWithLocInContext(<wbr>Context);<br>
         }<br>
<br>
-        NameInfo.setName(Context.<wbr>DeclarationNames.<wbr>getCXXConstructorName(<br>
-            Context.getCanonicalType(<wbr>Context.getRecordType(RD))));<br>
-        NameInfo.setNamedTypeInfo(<wbr>nullptr);<br>
+        // In this case, the name we introduce is the name of a derived class<br>
+        // constructor.<br>
+        auto *CurClass = cast<CXXRecordDecl>(<wbr>CurContext);<br>
+        UsingName.setName(Context.<wbr>DeclarationNames.<wbr>getCXXConstructorName(<br>
+            Context.getCanonicalType(<wbr>Context.getRecordType(<wbr>CurClass))));<br>
+        UsingName.setNamedTypeInfo(<wbr>nullptr);<br>
         for (auto *Ctor : LookupConstructors(RD))<br>
           R.addDecl(Ctor);<br>
+        R.resolveKind();<br>
       } else {<br>
-        // FIXME: Pick up all the declarations if we found an overloaded function.<br>
-        NameInfo.setName(ND-><wbr>getDeclName());<br>
+        // FIXME: Pick up all the declarations if we found an overloaded<br>
+        // function.<br>
+        UsingName.setName(ND-><wbr>getDeclName());<br>
         R.addDecl(ND);<br>
       }<br>
     } else {<br>
@@ -8310,17 +8421,16 @@ NamedDecl *Sema::BuildUsingDeclaration(S<br>
<br>
   UsingDecl *UD = BuildValid();<br>
<br>
-  // The normal rules do not apply to inheriting constructor declarations.<br>
-  if (NameInfo.getName().<wbr>getNameKind() == DeclarationName::<wbr>CXXConstructorName) {<br>
+  // Some additional rules apply to inheriting constructors.<br>
+  if (UsingName.getName().<wbr>getNameKind() ==<br>
+        DeclarationName::<wbr>CXXConstructorName) {<br>
     // Suppress access diagnostics; the access check is instead performed at the<br>
     // point of use for an inheriting constructor.<br>
     R.suppressDiagnostics();<br>
-    CheckInheritingConstructorUsin<wbr>gDecl(UD);<br>
-    return UD;<br>
+    if (<wbr>CheckInheritingConstructorUsin<wbr>gDecl(UD))<br>
+      return UD;<br>
   }<br>
<br>
-  // Otherwise, look up the target name.<br>
-<br>
   for (LookupResult::iterator I = R.begin(), E = R.end(); I != E; ++I) {<br>
     UsingShadowDecl *PrevDecl = nullptr;<br>
     if (!CheckUsingShadowDecl(UD, *I, Previous, PrevDecl))<br>
@@ -8895,7 +9005,8 @@ Sema::<wbr>ComputeDefaultedDefaultCtorExc<wbr>epti<br>
 }<br>
<br>
 Sema::<wbr>ImplicitExceptionSpecification<br>
-Sema::<wbr>ComputeInheritingCtorException<wbr>Spec(CXXConstructorDecl *CD) {<br>
+Sema::<wbr>ComputeInheritingCtorException<wbr>Spec(SourceLocation Loc,<br>
+                                         CXXConstructorDecl *CD) {<br>
   CXXRecordDecl *ClassDecl = CD->getParent();<br>
<br>
   // C++ [except.spec]p14:<br>
@@ -8904,36 +9015,26 @@ Sema::<wbr>ComputeInheritingCtorException<wbr>Spec<br>
   if (ClassDecl->isInvalidDecl())<br>
     return ExceptSpec;<br>
<br>
-  // Inherited constructor.<br>
-  const CXXConstructorDecl *InheritedCD = CD->getInheritedConstructor();<br>
-  const CXXRecordDecl *InheritedDecl = InheritedCD->getParent();<br>
-  // FIXME: Copying or moving the parameters could add extra exceptions to the<br>
-  // set, as could the default arguments for the inherited constructor. This<br>
-  // will be addressed when we implement the resolution of core issue 1351.<br>
-  ExceptSpec.CalledDecl(CD-><wbr>getLocStart(), InheritedCD);<br>
+  auto Inherited = CD->getInheritedConstructor();<br>
+  InheritedConstructorInfo ICI(*this, Loc, Inherited.getShadowDecl());<br>
<br>
-  // Direct base-class constructors.<br>
-  for (const auto &B : ClassDecl->bases()) {<br>
-    if (B.isVirtual()) // Handled below.<br>
-      continue;<br>
-<br>
-    if (const RecordType *BaseType = B.getType()->getAs<RecordType><wbr>()) {<br>
-      CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseType-><wbr>getDecl());<br>
-      if (BaseClassDecl == InheritedDecl)<br>
+  // Direct and virtual base-class constructors.<br>
+  for (bool VBase : {false, true}) {<br>
+    for (CXXBaseSpecifier &B :<br>
+         VBase ? ClassDecl->vbases() : ClassDecl->bases()) {<br>
+      // Don't visit direct vbases twice.<br>
+      if (B.isVirtual() != VBase)<br>
         continue;<br>
-      CXXConstructorDecl *Constructor = LookupDefaultConstructor(<wbr>BaseClassDecl);<br>
-      if (Constructor)<br>
-        ExceptSpec.CalledDecl(B.<wbr>getLocStart(), Constructor);<br>
-    }<br>
-  }<br>
<br>
-  // Virtual base-class constructors.<br>
-  for (const auto &B : ClassDecl->vbases()) {<br>
-    if (const RecordType *BaseType = B.getType()->getAs<RecordType><wbr>()) {<br>
-      CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseType-><wbr>getDecl());<br>
-      if (BaseClassDecl == InheritedDecl)<br>
+      CXXRecordDecl *BaseClass = B.getType()-><wbr>getAsCXXRecordDecl();<br>
+      if (!BaseClass)<br>
         continue;<br>
-      CXXConstructorDecl *Constructor = LookupDefaultConstructor(<wbr>BaseClassDecl);<br>
+<br>
+      CXXConstructorDecl *Constructor =<br>
+          ICI.findConstructorForBase(<wbr>BaseClass, Inherited.getConstructor())<br>
+              .first;<br>
+      if (!Constructor)<br>
+        Constructor = LookupDefaultConstructor(<wbr>BaseClass);<br>
       if (Constructor)<br>
         ExceptSpec.CalledDecl(B.<wbr>getLocStart(), Constructor);<br>
     }<br>
@@ -9111,325 +9212,156 @@ void Sema::<wbr>ActOnFinishDelayedMemberIniti<br>
   CheckDelayedMemberExceptionSpe<wbr>cs();<br>
 }<br>
<br>
-namespace {<br>
-/// Information on inheriting constructors to declare.<br>
-class InheritingConstructorInfo {<br>
-public:<br>
-  InheritingConstructorInfo(Sema &SemaRef, CXXRecordDecl *Derived)<br>
-      : SemaRef(SemaRef), Derived(Derived) {<br>
-    // Mark the constructors that we already have in the derived class.<br>
-    //<br>
-    // C++11 [class.inhctor]p3: [...] a constructor is implicitly declared [...]<br>
-    //   unless there is a user-declared constructor with the same signature in<br>
-    //   the class where the using-declaration appears.<br>
-    visitAll(Derived, &InheritingConstructorInfo::<wbr>noteDeclaredInDerived);<br>
-  }<br>
-<br>
-  void inheritAll(CXXRecordDecl *RD) {<br>
-    visitAll(RD, &InheritingConstructorInfo::<wbr>inherit);<br>
-  }<br>
-<br>
-private:<br>
-  /// Information about an inheriting constructor.<br>
-  struct InheritingConstructor {<br>
-    InheritingConstructor()<br>
-      : DeclaredInDerived(false), BaseCtor(nullptr), DerivedCtor(nullptr) {}<br>
-<br>
-    /// If \c true, a constructor with this signature is already declared<br>
-    /// in the derived class.<br>
-    bool DeclaredInDerived;<br>
-<br>
-    /// The constructor which is inherited.<br>
-    const CXXConstructorDecl *BaseCtor;<br>
-<br>
-    /// The derived constructor we declared.<br>
-    CXXConstructorDecl *DerivedCtor;<br>
-  };<br>
-<br>
-  /// Inheriting constructors with a given canonical type. There can be at<br>
-  /// most one such non-template constructor, and any number of templated<br>
-  /// constructors.<br>
-  struct InheritingConstructorsForType {<br>
-    InheritingConstructor NonTemplate;<br>
-    SmallVector<std::pair<<wbr>TemplateParameterList *, InheritingConstructor>, 4><br>
-        Templates;<br>
-<br>
-    InheritingConstructor &getEntry(Sema &S, const CXXConstructorDecl *Ctor) {<br>
-      if (FunctionTemplateDecl *FTD = Ctor-><wbr>getDescribedFunctionTemplate()<wbr>) {<br>
-        TemplateParameterList *ParamList = FTD->getTemplateParameters();<br>
-        for (unsigned I = 0, N = Templates.size(); I != N; ++I)<br>
-          if (S.<wbr>TemplateParameterListsAreEqual<wbr>(ParamList, Templates[I].first,<br>
-                                               false, S.TPL_TemplateMatch))<br>
-            return Templates[I].second;<br>
-        Templates.push_back(std::make_<wbr>pair(ParamList, InheritingConstructor()));<br>
-        return Templates.back().second;<br>
-      }<br>
-<br>
-      return NonTemplate;<br>
-    }<br>
-  };<br>
-<br>
-  /// Get or create the inheriting constructor record for a constructor.<br>
-  InheritingConstructor &getEntry(const CXXConstructorDecl *Ctor,<br>
-                                  QualType CtorType) {<br>
-    return Map[CtorType.getCanonicalType(<wbr>)->castAs<FunctionProtoType>()<wbr>]<br>
-        .getEntry(SemaRef, Ctor);<br>
-  }<br>
+/// Find or create the fake constructor we synthesize to model constructing an<br>
+/// object of a derived class via a constructor of a base class.<br>
+CXXConstructorDecl *<br>
+Sema::<wbr>findInheritingConstructor(<wbr>SourceLocation Loc,<br>
+                                CXXConstructorDecl *BaseCtor,<br>
+                                ConstructorUsingShadowDecl *Shadow) {<br>
+  CXXRecordDecl *Derived = Shadow->getParent();<br>
+  SourceLocation UsingLoc = Shadow->getLocation();<br>
+<br>
+  // FIXME: Add a new kind of DeclarationName for an inherited constructor.<br>
+  // For now we use the name of the base class constructor as a member of the<br>
+  // derived class to indicate a (fake) inherited constructor name.<br>
+  DeclarationName Name = BaseCtor->getDeclName();<br>
+<br>
+  // Check to see if we already have a fake constructor for this inherited<br>
+  // constructor call.<br>
+  for (NamedDecl *Ctor : Derived->lookup(Name))<br>
+    if (declaresSameEntity(cast<<wbr>CXXConstructorDecl>(Ctor)<br>
+                               ->getInheritedConstructor()<br>
+                               .getConstructor(),<br>
+                           BaseCtor))<br>
+      return cast<CXXConstructorDecl>(Ctor)<wbr>;<br>
+<br>
+  DeclarationNameInfo NameInfo(Name, UsingLoc);<br>
+  TypeSourceInfo *TInfo =<br>
+      Context.<wbr>getTrivialTypeSourceInfo(<wbr>BaseCtor->getType(), UsingLoc);<br>
+  FunctionProtoTypeLoc ProtoLoc =<br>
+      TInfo->getTypeLoc().<wbr>IgnoreParens().castAs<<wbr>FunctionProtoTypeLoc>();<br>
+<br>
+  // Check the inherited constructor is valid and find the list of base classes<br>
+  // from which it was inherited.<br>
+  InheritedConstructorInfo ICI(*this, Loc, Shadow);<br>
+<br>
+  bool Constexpr =<br>
+      BaseCtor->isConstexpr() &&<br>
+      defaultedSpecialMemberIsConste<wbr>xpr(*this, Derived, CXXDefaultConstructor,<br>
+                                        false, BaseCtor, &ICI);<br>
+<br>
+  CXXConstructorDecl *DerivedCtor = CXXConstructorDecl::Create(<br>
+      Context, Derived, UsingLoc, NameInfo, TInfo->getType(), TInfo,<br>
+      BaseCtor->isExplicit(), /*Inline=*/true,<br>
+      /*ImplicitlyDeclared=*/true, Constexpr,<br>
+      InheritedConstructor(Shadow, BaseCtor));<br>
+  if (Shadow->isInvalidDecl())<br>
+    DerivedCtor->setInvalidDecl();<br>
+<br>
+  // Build an unevaluated exception specification for this fake constructor.<br>
+  const FunctionProtoType *FPT = TInfo->getType()->castAs<<wbr>FunctionProtoType>();<br>
+  FunctionProtoType::<wbr>ExtProtoInfo EPI = FPT->getExtProtoInfo();<br>
+  EPI.ExceptionSpec.Type = EST_Unevaluated;<br>
+  EPI.ExceptionSpec.SourceDecl = DerivedCtor;<br>
+  DerivedCtor->setType(Context.<wbr>getFunctionType(FPT-><wbr>getReturnType(),<br>
+                                               FPT->getParamTypes(), EPI));<br>
+<br>
+  // Build the parameter declarations.<br>
+  SmallVector<ParmVarDecl *, 16> ParamDecls;<br>
+  for (unsigned I = 0, N = FPT->getNumParams(); I != N; ++I) {<br>
+    TypeSourceInfo *TInfo =<br>
+        Context.<wbr>getTrivialTypeSourceInfo(FPT-><wbr>getParamType(I), UsingLoc);<br>
+    ParmVarDecl *PD = ParmVarDecl::Create(<br>
+        Context, DerivedCtor, UsingLoc, UsingLoc, /*IdentifierInfo=*/nullptr,<br>
+        FPT->getParamType(I), TInfo, SC_None, /*DefaultArg=*/nullptr);<br>
+    PD->setScopeInfo(0, I);<br>
+    PD->setImplicit();<br>
+    // Ensure attributes are propagated onto parameters (this matters for<br>
+    // format, pass_object_size, ...).<br>
+    mergeDeclAttributes(PD, BaseCtor->getParamDecl(I));<br>
+    ParamDecls.push_back(PD);<br>
+    ProtoLoc.setParam(I, PD);<br>
+  }<br>
+<br>
+  // Set up the new constructor.<br>
+  assert(!BaseCtor->isDeleted() && "should not use deleted constructor");<br>
+  DerivedCtor->setAccess(<wbr>BaseCtor->getAccess());<br>
+  DerivedCtor->setParams(<wbr>ParamDecls);<br>
+  Derived->addDecl(DerivedCtor);<br>
+  return DerivedCtor;<br>
+}<br>
<br>
-  typedef void (InheritingConstructorInfo::*<wbr>VisitFn)(const CXXConstructorDecl*);<br>
-<br>
-  /// Process all constructors for a class.<br>
-  void visitAll(const CXXRecordDecl *RD, VisitFn Callback) {<br>
-    for (const auto *Ctor : RD->ctors())<br>
-      (this->*Callback)(Ctor);<br>
-    for (CXXRecordDecl::specific_decl_<wbr>iterator<FunctionTemplateDecl><br>
-             I(RD->decls_begin()), E(RD->decls_end());<br>
-         I != E; ++I) {<br>
-      const FunctionDecl *FD = (*I)->getTemplatedDecl();<br>
-      if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(<wbr>FD))<br>
-        (this->*Callback)(CD);<br>
-    }<br>
-  }<br>
+void Sema::<wbr>DefineInheritingConstructor(<wbr>SourceLocation CurrentLocation,<br>
+                                       CXXConstructorDecl *Constructor) {<br>
+  CXXRecordDecl *ClassDecl = Constructor->getParent();<br>
+  assert(Constructor-><wbr>getInheritedConstructor() &&<br>
+         !Constructor-><wbr>doesThisDeclarationHaveABody() &&<br>
+         !Constructor->isDeleted());<br>
+  if (Constructor->isInvalidDecl())<br>
+    return;<br>
<br>
-  /// Note that a constructor (or constructor template) was declared in Derived.<br>
-  void noteDeclaredInDerived(const CXXConstructorDecl *Ctor) {<br>
-    getEntry(Ctor, Ctor->getType()).<wbr>DeclaredInDerived = true;<br>
-  }<br>
+  ConstructorUsingShadowDecl *Shadow =<br>
+      Constructor-><wbr>getInheritedConstructor().<wbr>getShadowDecl();<br>
+  CXXConstructorDecl *InheritedCtor =<br>
+      Constructor-><wbr>getInheritedConstructor().<wbr>getConstructor();<br>
<br>
-  /// Inherit a single constructor.<br>
-  void inherit(const CXXConstructorDecl *Ctor) {<br>
-    const FunctionProtoType *CtorType =<br>
-        Ctor->getType()->castAs<<wbr>FunctionProtoType>();<br>
-    ArrayRef<QualType> ArgTypes = CtorType->getParamTypes();<br>
-    FunctionProtoType::<wbr>ExtProtoInfo EPI = CtorType->getExtProtoInfo();<br>
+  // [class.inhctor.init]p1:<br>
+  //   initialization proceeds as if a defaulted default constructor is used to<br>
+  //   initialize the D object and each base class subobject from which the<br>
+  //   constructor was inherited<br>
<br>
-    SourceLocation UsingLoc = getUsingLoc(Ctor->getParent())<wbr>;<br>
+  InheritedConstructorInfo ICI(*this, CurrentLocation, Shadow);<br>
+  CXXRecordDecl *RD = Shadow->getParent();<br>
+  SourceLocation InitLoc = Shadow->getLocation();<br>
<br>
-    // Core issue (no number yet): the ellipsis is always discarded.<br>
-    if (EPI.Variadic) {<br>
-      SemaRef.Diag(UsingLoc, diag::warn_using_decl_<wbr>constructor_ellipsis);<br>
-      SemaRef.Diag(Ctor-><wbr>getLocation(),<br>
-                   diag::note_using_decl_<wbr>constructor_ellipsis);<br>
-      EPI.Variadic = false;<br>
-    }<br>
+  // Initializations are performed "as if by a defaulted default constructor",<br>
+  // so enter the appropriate scope.<br>
+  SynthesizedFunctionScope Scope(*this, Constructor);<br>
+  DiagnosticErrorTrap Trap(Diags);<br>
<br>
-    // Declare a constructor for each number of parameters.<br>
-    //<br>
-    // C++11 [class.inhctor]p1:<br>
-    //   The candidate set of inherited constructors from the class X named in<br>
-    //   the using-declaration consists of [... modulo defects ...] for each<br>
-    //   constructor or constructor template of X, the set of constructors or<br>
-    //   constructor templates that results from omitting any ellipsis parameter<br>
-    //   specification and successively omitting parameters with a default<br>
-    //   argument from the end of the parameter-type-list<br>
-    unsigned MinParams = minParamsToInherit(Ctor);<br>
-    unsigned Params = Ctor->getNumParams();<br>
-    if (Params >= MinParams) {<br>
-      do<br>
-        declareCtor(UsingLoc, Ctor,<br>
-                    SemaRef.Context.<wbr>getFunctionType(<br>
-                        Ctor->getReturnType(), ArgTypes.slice(0, Params), EPI));<br>
-      while (Params > MinParams &&<br>
-             Ctor->getParamDecl(--Params)-><wbr>hasDefaultArg());<br>
-    }<br>
-  }<br>
-<br>
-  /// Find the using-declaration which specified that we should inherit the<br>
-  /// constructors of \p Base.<br>
-  SourceLocation getUsingLoc(const CXXRecordDecl *Base) {<br>
-    // No fancy lookup required; just look for the base constructor name<br>
-    // directly within the derived class.<br>
-    ASTContext &Context = SemaRef.Context;<br>
-    DeclarationName Name = Context.DeclarationNames.<wbr>getCXXConstructorName(<br>
-        Context.getCanonicalType(<wbr>Context.getRecordType(Base)));<br>
-    DeclContext::lookup_result Decls = Derived->lookup(Name);<br>
-    return Decls.empty() ? Derived->getLocation() : Decls[0]->getLocation();<br>
-  }<br>
-<br>
-  unsigned minParamsToInherit(const CXXConstructorDecl *Ctor) {<br>
-    // C++11 [class.inhctor]p3:<br>
-    //   [F]or each constructor template in the candidate set of inherited<br>
-    //   constructors, a constructor template is implicitly declared<br>
-    if (Ctor-><wbr>getDescribedFunctionTemplate()<wbr>)<br>
-      return 0;<br>
-<br>
-    //   For each non-template constructor in the candidate set of inherited<br>
-    //   constructors other than a constructor having no parameters or a<br>
-    //   copy/move constructor having a single parameter, a constructor is<br>
-    //   implicitly declared [...]<br>
-    if (Ctor->getNumParams() == 0)<br>
-      return 1;<br>
-    if (Ctor-><wbr>isCopyOrMoveConstructor())<br>
-      return 2;<br>
-<br>
-    // Per discussion on core reflector, never inherit a constructor which<br>
-    // would become a default, copy, or move constructor of Derived either.<br>
-    const ParmVarDecl *PD = Ctor->getParamDecl(0);<br>
-    const ReferenceType *RT = PD->getType()->getAs<<wbr>ReferenceType>();<br>
-    return (RT && RT->getPointeeCXXRecordDecl() == Derived) ? 2 : 1;<br>
-  }<br>
-<br>
-  /// Declare a single inheriting constructor, inheriting the specified<br>
-  /// constructor, with the given type.<br>
-  void declareCtor(SourceLocation UsingLoc, const CXXConstructorDecl *BaseCtor,<br>
-                   QualType DerivedType) {<br>
-    InheritingConstructor &Entry = getEntry(BaseCtor, DerivedType);<br>
-<br>
-    // C++11 [class.inhctor]p3:<br>
-    //   ... a constructor is implicitly declared with the same constructor<br>
-    //   characteristics unless there is a user-declared constructor with<br>
-    //   the same signature in the class where the using-declaration appears<br>
-    if (Entry.DeclaredInDerived)<br>
-      return;<br>
+  // Build explicit initializers for all base classes from which the<br>
+  // constructor was inherited.<br>
+  SmallVector<<wbr>CXXCtorInitializer*, 8> Inits;<br>
+  for (bool VBase : {false, true}) {<br>
+    for (CXXBaseSpecifier &B : VBase ? RD->vbases() : RD->bases()) {<br>
+      if (B.isVirtual() != VBase)<br>
+        continue;<br>
<br>
-    // C++11 [class.inhctor]p7:<br>
-    //   If two using-declarations declare inheriting constructors with the<br>
-    //   same signature, the program is ill-formed<br>
-    if (Entry.DerivedCtor) {<br>
-      if (BaseCtor->getParent() != Entry.BaseCtor->getParent()) {<br>
-        // Only diagnose this once per constructor.<br>
-        if (Entry.DerivedCtor-><wbr>isInvalidDecl())<br>
-          return;<br>
-        Entry.DerivedCtor-><wbr>setInvalidDecl();<br>
-<br>
-        SemaRef.Diag(UsingLoc, diag::err_using_decl_<wbr>constructor_conflict);<br>
-        SemaRef.Diag(BaseCtor-><wbr>getLocation(),<br>
-                     diag::note_using_decl_<wbr>constructor_conflict_current_<wbr>ctor);<br>
-        SemaRef.Diag(Entry.BaseCtor-><wbr>getLocation(),<br>
-                     diag::note_using_decl_<wbr>constructor_conflict_previous_<wbr>ctor);<br>
-        SemaRef.Diag(Entry.<wbr>DerivedCtor->getLocation(),<br>
-                     diag::note_using_decl_<wbr>constructor_conflict_previous_<wbr>using);<br>
-      } else {<br>
-        // Core issue (no number): if the same inheriting constructor is<br>
-        // produced by multiple base class constructors from the same base<br>
-        // class, the inheriting constructor is defined as deleted.<br>
-        SemaRef.SetDeclDeleted(Entry.<wbr>DerivedCtor, UsingLoc);<br>
-      }<br>
+      auto *BaseRD = B.getType()-><wbr>getAsCXXRecordDecl();<br>
+      if (!BaseRD)<br>
+        continue;<br>
<br>
-      return;<br>
-    }<br>
+      auto BaseCtor = ICI.findConstructorForBase(<wbr>BaseRD, InheritedCtor);<br>
+      if (!BaseCtor.first)<br>
+        continue;<br>
<br>
-    ASTContext &Context = SemaRef.Context;<br>
-    DeclarationName Name = Context.DeclarationNames.<wbr>getCXXConstructorName(<br>
-        Context.getCanonicalType(<wbr>Context.getRecordType(Derived)<wbr>));<br>
-    DeclarationNameInfo NameInfo(Name, UsingLoc);<br>
-<br>
-    TemplateParameterList *TemplateParams = nullptr;<br>
-    if (const FunctionTemplateDecl *FTD =<br>
-            BaseCtor-><wbr>getDescribedFunctionTemplate()<wbr>) {<br>
-      TemplateParams = FTD->getTemplateParameters();<br>
-      // We're reusing template parameters from a different DeclContext. This<br>
-      // is questionable at best, but works out because the template depth in<br>
-      // both places is guaranteed to be 0.<br>
-      // FIXME: Rebuild the template parameters in the new context, and<br>
-      // transform the function type to refer to them.<br>
-    }<br>
+      MarkFunctionReferenced(<wbr>CurrentLocation, BaseCtor.first);<br>
+      ExprResult Init = new (Context) CXXInheritedCtorInitExpr(<br>
+          InitLoc, B.getType(), BaseCtor.first, VBase, BaseCtor.second);<br>
<br>
-    // Build type source info pointing at the using-declaration. This is<br>
-    // required by template instantiation.<br>
-    TypeSourceInfo *TInfo =<br>
-        Context.<wbr>getTrivialTypeSourceInfo(<wbr>DerivedType, UsingLoc);<br>
-    FunctionProtoTypeLoc ProtoLoc =<br>
-        TInfo->getTypeLoc().<wbr>IgnoreParens().castAs<<wbr>FunctionProtoTypeLoc>();<br>
-<br>
-    CXXConstructorDecl *DerivedCtor = CXXConstructorDecl::Create(<br>
-        Context, Derived, UsingLoc, NameInfo, DerivedType,<br>
-        TInfo, BaseCtor->isExplicit(), /*Inline=*/true,<br>
-        /*ImplicitlyDeclared=*/true, /*Constexpr=*/BaseCtor-><wbr>isConstexpr());<br>
-<br>
-    // Build an unevaluated exception specification for this constructor.<br>
-    const FunctionProtoType *FPT = DerivedType->castAs<<wbr>FunctionProtoType>();<br>
-    FunctionProtoType::<wbr>ExtProtoInfo EPI = FPT->getExtProtoInfo();<br>
-    EPI.ExceptionSpec.Type = EST_Unevaluated;<br>
-    EPI.ExceptionSpec.SourceDecl = DerivedCtor;<br>
-    DerivedCtor->setType(Context.<wbr>getFunctionType(FPT-><wbr>getReturnType(),<br>
-                                                 FPT->getParamTypes(), EPI));<br>
-<br>
-    // Build the parameter declarations.<br>
-    SmallVector<ParmVarDecl *, 16> ParamDecls;<br>
-    for (unsigned I = 0, N = FPT->getNumParams(); I != N; ++I) {<br>
-      TypeSourceInfo *TInfo =<br>
-          Context.<wbr>getTrivialTypeSourceInfo(FPT-><wbr>getParamType(I), UsingLoc);<br>
-      ParmVarDecl *PD = ParmVarDecl::Create(<br>
-          Context, DerivedCtor, UsingLoc, UsingLoc, /*IdentifierInfo=*/nullptr,<br>
-          FPT->getParamType(I), TInfo, SC_None, /*DefaultArg=*/nullptr);<br>
-      PD->setScopeInfo(0, I);<br>
-      PD->setImplicit();<br>
-      ParamDecls.push_back(PD);<br>
-      ProtoLoc.setParam(I, PD);<br>
-    }<br>
-<br>
-    // Set up the new constructor.<br>
-    DerivedCtor->setAccess(<wbr>BaseCtor->getAccess());<br>
-    DerivedCtor->setParams(<wbr>ParamDecls);<br>
-    DerivedCtor-><wbr>setInheritedConstructor(<wbr>BaseCtor);<br>
-    if (BaseCtor->isDeleted())<br>
-      SemaRef.SetDeclDeleted(<wbr>DerivedCtor, UsingLoc);<br>
-<br>
-    // If this is a constructor template, build the template declaration.<br>
-    if (TemplateParams) {<br>
-      FunctionTemplateDecl *DerivedTemplate =<br>
-          FunctionTemplateDecl::Create(<wbr>SemaRef.Context, Derived, UsingLoc, Name,<br>
-                                       TemplateParams, DerivedCtor);<br>
-      DerivedTemplate->setAccess(<wbr>BaseCtor->getAccess());<br>
-      DerivedCtor-><wbr>setDescribedFunctionTemplate(<wbr>DerivedTemplate);<br>
-      Derived->addDecl(<wbr>DerivedTemplate);<br>
-    } else {<br>
-      Derived->addDecl(DerivedCtor);<br>
+      auto *TInfo = Context.<wbr>getTrivialTypeSourceInfo(B.<wbr>getType(), InitLoc);<br>
+      Inits.push_back(new (Context) CXXCtorInitializer(<br>
+          Context, TInfo, VBase, InitLoc, Init.get(), InitLoc,<br>
+          SourceLocation()));<br>
     }<br>
-<br>
-    Entry.BaseCtor = BaseCtor;<br>
-    Entry.DerivedCtor = DerivedCtor;<br>
   }<br>
<br>
-  Sema &SemaRef;<br>
-  CXXRecordDecl *Derived;<br>
-  typedef llvm::DenseMap<const Type *, InheritingConstructorsForType> MapType;<br>
-  MapType Map;<br>
-};<br>
-}<br>
-<br>
-void Sema::<wbr>DeclareInheritingConstructors(<wbr>CXXRecordDecl *ClassDecl) {<br>
-  // Defer declaring the inheriting constructors until the class is<br>
-  // instantiated.<br>
-  if (ClassDecl-><wbr>isDependentContext())<br>
-    return;<br>
-<br>
-  // Find base classes from which we might inherit constructors.<br>
-  SmallVector<CXXRecordDecl*, 4> InheritedBases;<br>
-  for (const auto &BaseIt : ClassDecl->bases())<br>
-    if (BaseIt.<wbr>getInheritConstructors())<br>
-      InheritedBases.push_back(<wbr>BaseIt.getType()-><wbr>getAsCXXRecordDecl());<br>
-<br>
-  // Go no further if we're not inheriting any constructors.<br>
-  if (InheritedBases.empty())<br>
-    return;<br>
-<br>
-  // Declare the inherited constructors.<br>
-  InheritingConstructorInfo ICI(*this, ClassDecl);<br>
-  for (unsigned I = 0, N = InheritedBases.size(); I != N; ++I)<br>
-    ICI.inheritAll(InheritedBases[<wbr>I]);<br>
-}<br>
+  // We now proceed as if for a defaulted default constructor, with the relevant<br>
+  // initializers replaced.<br>
<br>
-void Sema::<wbr>DefineInheritingConstructor(<wbr>SourceLocation CurrentLocation,<br>
-                                       CXXConstructorDecl *Constructor) {<br>
-  CXXRecordDecl *ClassDecl = Constructor->getParent();<br>
-  assert(Constructor-><wbr>getInheritedConstructor() &&<br>
-         !Constructor-><wbr>doesThisDeclarationHaveABody() &&<br>
-         !Constructor->isDeleted());<br>
-<br>
-  SynthesizedFunctionScope Scope(*this, Constructor);<br>
-  DiagnosticErrorTrap Trap(Diags);<br>
-  if (SetCtorInitializers(<wbr>Constructor, /*AnyErrors=*/false) ||<br>
-      Trap.hasErrorOccurred()) {<br>
-    Diag(CurrentLocation, diag::note_inhctor_<wbr>synthesized_at)<br>
-      << Context.getTagDeclType(<wbr>ClassDecl);<br>
+  bool HadError = SetCtorInitializers(<wbr>Constructor, /*AnyErrors*/false, Inits);<br>
+  if (HadError || Trap.hasErrorOccurred()) {<br>
+    Diag(CurrentLocation, diag::note_inhctor_<wbr>synthesized_at) << RD;<br>
     Constructor->setInvalidDecl();<br>
     return;<br>
   }<br>
<br>
-  SourceLocation Loc = Constructor->getLocation();<br>
-  Constructor->setBody(new (Context) CompoundStmt(Loc));<br>
+  // The exception specification is needed because we are defining the<br>
+  // function.<br>
+  ResolveExceptionSpec(<wbr>CurrentLocation,<br>
+                       Constructor->getType()-><wbr>castAs<FunctionProtoType>());<br>
+<br>
+  Constructor->setBody(new (Context) CompoundStmt(InitLoc));<br>
<br>
   Constructor->markUsed(Context)<wbr>;<br>
   MarkVTableUsed(<wbr>CurrentLocation, ClassDecl);<br>
@@ -9437,8 +9369,9 @@ void Sema::<wbr>DefineInheritingConstructor(S<br>
   if (ASTMutationListener *L = getASTMutationListener()) {<br>
     L-><wbr>CompletedImplicitDefinition(<wbr>Constructor);<br>
   }<br>
-}<br>
<br>
+  DiagnoseUninitializedFields(*<wbr>this, Constructor);<br>
+}<br>
<br>
 Sema::<wbr>ImplicitExceptionSpecification<br>
 Sema::<wbr>ComputeDefaultedDtorExceptionS<wbr>pec(CXXMethodDecl *MD) {<br>
@@ -11481,10 +11414,11 @@ Sema::BuildCXXConstructExpr(<wbr>SourceLocati<br>
   //       with the same cv-unqualified type, the copy/move operation<br>
   //       can be omitted by constructing the temporary object<br>
   //       directly into the target of the omitted copy/move<br>
-  if (ConstructKind == CXXConstructExpr::CK_Complete &&<br>
+  if (ConstructKind == CXXConstructExpr::CK_Complete && Constructor &&<br>
       Constructor-><wbr>isCopyOrMoveConstructor() && hasOneRealArgument(ExprArgs)) {<br>
     Expr *SubExpr = ExprArgs[0];<br>
-    Elidable = SubExpr->isTemporaryObject(<wbr>Context, Constructor->getParent());<br>
+    Elidable = SubExpr->isTemporaryObject(<br>
+        Context, cast<CXXRecordDecl>(FoundDecl-<wbr>>getDeclContext()));<br>
   }<br>
<br>
   return BuildCXXConstructExpr(<wbr>ConstructLoc, DeclInitType,<br>
@@ -11507,6 +11441,9 @@ Sema::BuildCXXConstructExpr(<wbr>SourceLocati<br>
                             bool RequiresZeroInit,<br>
                             unsigned ConstructKind,<br>
                             SourceRange ParenRange) {<br>
+  if (auto *Shadow = dyn_cast<<wbr>ConstructorUsingShadowDecl>(<wbr>FoundDecl))<br>
+    Constructor = findInheritingConstructor(<wbr>ConstructLoc, Constructor, Shadow);<br>
+<br>
   return BuildCXXConstructExpr(<br>
       ConstructLoc, DeclInitType, Constructor, Elidable, ExprArgs,<br>
       HadMultipleCandidates, IsListInitialization, IsStdInitListInitialization,<br>
@@ -11526,7 +11463,12 @@ Sema::BuildCXXConstructExpr(<wbr>SourceLocati<br>
                             bool RequiresZeroInit,<br>
                             unsigned ConstructKind,<br>
                             SourceRange ParenRange) {<br>
+  assert(declaresSameEntity(<br>
+             Constructor->getParent(),<br>
+             DeclInitType-><wbr>getBaseElementTypeUnsafe()-><wbr>getAsCXXRecordDecl()) &&<br>
+         "given constructor for wrong type");<br>
   MarkFunctionReferenced(<wbr>ConstructLoc, Constructor);<br>
+<br>
   return CXXConstructExpr::Create(<br>
       Context, DeclInitType, ConstructLoc, Constructor, Elidable,<br>
       ExprArgs, HadMultipleCandidates, IsListInitialization,<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaExceptionSpec.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaExceptionSpec.cpp?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaExceptionSpec.cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaExceptionSpec.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1001,6 +1001,10 @@ CanThrowResult Sema::canThrow(const Expr<br>
     return mergeCanThrow(CT, canSubExprsThrow(*this, E));<br>
   }<br>
<br>
+  case Expr::<wbr>CXXInheritedCtorInitExprClass:<br>
+    return canCalleeThrow(*this, E,<br>
+                          cast<CXXInheritedCtorInitExpr><wbr>(E)->getConstructor());<br>
+<br>
   case Expr::LambdaExprClass: {<br>
     const LambdaExpr *Lambda = cast<LambdaExpr>(E);<br>
     CanThrowResult CT = CT_Cannot;<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaExpr.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaExpr.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/SemaExpr.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaExpr.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -221,21 +221,6 @@ void Sema::NoteDeletedFunction(<wbr>FunctionD<br>
     return;<br>
   }<br>
<br>
-  if (CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(<wbr>Decl)) {<br>
-    if (CXXConstructorDecl *BaseCD =<br>
-            const_cast<CXXConstructorDecl*<wbr>>(CD->getInheritedConstructor(<wbr>))) {<br>
-      Diag(Decl->getLocation(), diag::note_inherited_deleted_<wbr>here);<br>
-      if (BaseCD->isDeleted()) {<br>
-        NoteDeletedFunction(BaseCD);<br>
-      } else {<br>
-        // FIXME: An explanation of why exactly it can't be inherited<br>
-        // would be nice.<br>
-        Diag(BaseCD->getLocation(), diag::note_cannot_inherit);<br>
-      }<br>
-      return;<br>
-    }<br>
-  }<br>
-<br>
   Diag(Decl->getLocation(), diag::note_availability_<wbr>specified_here)<br>
     << Decl << true;<br>
 }<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaExprCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaExprCXX.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaExprCXX.cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaExprCXX.cpp Tue Jun 28 14:03:57 2016<br>
@@ -3186,9 +3186,8 @@ static ExprResult BuildCXXCastArgument(S<br>
     if (S.CompleteConstructorCall(<wbr>Constructor, From, CastLoc, ConstructorArgs))<br>
       return ExprError();<br>
<br>
-    S.CheckConstructorAccess(<wbr>CastLoc, Constructor,<br>
-                             InitializedEntity::<wbr>InitializeTemporary(Ty),<br>
-                             Constructor->getAccess());<br>
+    S.CheckConstructorAccess(<wbr>CastLoc, Constructor, FoundDecl,<br>
+                             InitializedEntity::<wbr>InitializeTemporary(Ty));<br>
     if (S.DiagnoseUseOfDecl(Method, CastLoc))<br>
       return ExprError();<br>
<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaInit.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaInit.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/SemaInit.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaInit.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -5519,8 +5519,8 @@ static ExprResult CopyObject(Sema &S,<br>
   SmallVector<Expr*, 8> ConstructorArgs;<br>
   CurInit.get(); // Ownership transferred into MultiExprArg, below.<br>
<br>
-  S.CheckConstructorAccess(Loc, Constructor, Entity,<br>
-                           Best->FoundDecl.getAccess(), IsExtraneousCopy);<br>
+  S.CheckConstructorAccess(Loc, Constructor, Best->FoundDecl, Entity,<br>
+                           IsExtraneousCopy);<br>
<br>
   if (IsExtraneousCopy) {<br>
     // If this is a totally extraneous copy for C++03 reference<br>
@@ -5603,7 +5603,7 @@ static void CheckCXX98CompatAccessibleCo<br>
   switch (OR) {<br>
   case OR_Success:<br>
     S.CheckConstructorAccess(Loc, cast<CXXConstructorDecl>(Best-<wbr>>Function),<br>
-                             Entity, Best->FoundDecl.getAccess(), Diag);<br>
+                             Best->FoundDecl, Entity, Diag);<br>
     // FIXME: Check default arguments as far as that's possible.<br>
     break;<br>
<br>
@@ -5729,7 +5729,6 @@ PerformConstructorInitializati<wbr>on(Sema &S<br>
<br>
   if (isExplicitTemporary(Entity, Kind, NumArgs)) {<br>
     // An explicitly-constructed temporary, e.g., X(1, 2).<br>
-    S.MarkFunctionReferenced(Loc, Constructor);<br>
     if (S.DiagnoseUseOfDecl(<wbr>Constructor, Loc))<br>
       return ExprError();<br>
<br>
@@ -5741,6 +5740,11 @@ PerformConstructorInitializati<wbr>on(Sema &S<br>
       ? SourceRange(LBraceLoc, RBraceLoc)<br>
       : Kind.getParenRange();<br>
<br>
+    if (auto *Shadow = dyn_cast<<wbr>ConstructorUsingShadowDecl>(<br>
+            Step.Function.FoundDecl.<wbr>getDecl()))<br>
+      Constructor = S.findInheritingConstructor(<wbr>Loc, Constructor, Shadow);<br>
+    S.MarkFunctionReferenced(Loc, Constructor);<br>
+<br>
     CurInit = new (S.Context) CXXTemporaryObjectExpr(<br>
         S.Context, Constructor, TSInfo,<br>
         ConstructorArgs, ParenOrBraceRange, HadMultipleCandidates,<br>
@@ -5795,8 +5799,7 @@ PerformConstructorInitializati<wbr>on(Sema &S<br>
     return ExprError();<br>
<br>
   // Only check access if all of that succeeded.<br>
-  S.CheckConstructorAccess(Loc, Constructor, Entity,<br>
-                           Step.Function.FoundDecl.<wbr>getAccess());<br>
+  S.CheckConstructorAccess(Loc, Constructor, Step.Function.FoundDecl, Entity);<br>
   if (S.DiagnoseUseOfDecl(Step.<wbr>Function.FoundDecl, Loc))<br>
     return ExprError();<br>
<br>
@@ -6529,8 +6532,8 @@ InitializationSequence::<wbr>Perform(Sema &S,<br>
         if (CurInit.isInvalid())<br>
           return ExprError();<br>
<br>
-        S.CheckConstructorAccess(Kind.<wbr>getLocation(), Constructor, Entity,<br>
-                                 FoundFn.getAccess());<br>
+        S.CheckConstructorAccess(Kind.<wbr>getLocation(), Constructor, FoundFn,<br>
+                                 Entity);<br>
         if (S.DiagnoseUseOfDecl(FoundFn, Kind.getLocation()))<br>
           return ExprError();<br>
<br>
@@ -7296,13 +7299,16 @@ bool InitializationSequence::<wbr>Diagnose(Se<br>
           // initialize this base/member.<br>
           CXXConstructorDecl *Constructor<br>
             = cast<CXXConstructorDecl>(S.<wbr>CurContext);<br>
+          const CXXRecordDecl *InheritedFrom = nullptr;<br>
+          if (auto Inherited = Constructor-><wbr>getInheritedConstructor())<br>
+            InheritedFrom = Inherited.getShadowDecl()-><wbr>getNominatedBaseClass();<br>
           if (Entity.getKind() == InitializedEntity::EK_Base) {<br>
             S.Diag(Kind.getLocation(), diag::err_missing_default_<wbr>ctor)<br>
-              << (Constructor-><wbr>getInheritedConstructor() ? 2 :<br>
-                  Constructor->isImplicit() ? 1 : 0)<br>
+              << (InheritedFrom ? 2 : Constructor->isImplicit() ? 1 : 0)<br>
               << S.Context.getTypeDeclType(<wbr>Constructor->getParent())<br>
               << /*base=*/0<br>
-              << Entity.getType();<br>
+              << Entity.getType()<br>
+              << InheritedFrom;<br>
<br>
             RecordDecl *BaseDecl<br>
               = Entity.getBaseSpecifier()-><wbr>getType()->getAs<RecordType>()<br>
@@ -7311,11 +7317,11 @@ bool InitializationSequence::<wbr>Diagnose(Se<br>
               << S.Context.getTagDeclType(<wbr>BaseDecl);<br>
           } else {<br>
             S.Diag(Kind.getLocation(), diag::err_missing_default_<wbr>ctor)<br>
-              << (Constructor-><wbr>getInheritedConstructor() ? 2 :<br>
-                  Constructor->isImplicit() ? 1 : 0)<br>
+              << (InheritedFrom ? 2 : Constructor->isImplicit() ? 1 : 0)<br>
               << S.Context.getTypeDeclType(<wbr>Constructor->getParent())<br>
               << /*member=*/1<br>
-              << Entity.getName();<br>
+              << Entity.getName()<br>
+              << InheritedFrom;<br>
             S.Diag(Entity.getDecl()-><wbr>getLocation(),<br>
                    diag::note_member_declared_at)<wbr>;<br>
<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaLookup.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaLookup.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/SemaLookup.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaLookup.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -2943,42 +2943,38 @@ Sema::<wbr>SpecialMemberOverloadResult *Sema:<br>
   // from an external source and invalidate lookup_result.<br>
   SmallVector<NamedDecl *, 8> Candidates(R.begin(), R.end());<br>
<br>
-  for (auto *Cand : Candidates) {<br>
-    if (Cand->isInvalidDecl())<br>
+  for (NamedDecl *CandDecl : Candidates) {<br>
+    if (CandDecl->isInvalidDecl())<br>
       continue;<br>
<br>
-    if (UsingShadowDecl *U = dyn_cast<UsingShadowDecl>(<wbr>Cand)) {<br>
-      // FIXME: [namespace.udecl]p15 says that we should only consider a<br>
-      // using declaration here if it does not match a declaration in the<br>
-      // derived class. We do not implement this correctly in other cases<br>
-      // either.<br>
-      Cand = U->getTargetDecl();<br>
-<br>
-      if (Cand->isInvalidDecl())<br>
-        continue;<br>
-    }<br>
-<br>
-    if (CXXMethodDecl *M = dyn_cast<CXXMethodDecl>(Cand)) {<br>
+    DeclAccessPair Cand = DeclAccessPair::make(CandDecl, AS_public);<br>
+    auto CtorInfo = getConstructorInfo(Cand);<br>
+    if (CXXMethodDecl *M = dyn_cast<CXXMethodDecl>(Cand-><wbr>getUnderlyingDecl())) {<br>
       if (SM == CXXCopyAssignment || SM == CXXMoveAssignment)<br>
-        AddMethodCandidate(M, DeclAccessPair::make(M, AS_public), RD, ThisTy,<br>
-                           Classification, llvm::makeArrayRef(&Arg, NumArgs),<br>
-                           OCS, true);<br>
-      else<br>
-        AddOverloadCandidate(M, DeclAccessPair::make(M, AS_public),<br>
+        AddMethodCandidate(M, Cand, RD, ThisTy, Classification,<br>
+                           llvm::makeArrayRef(&Arg, NumArgs), OCS, true);<br>
+      else if (CtorInfo)<br>
+        AddOverloadCandidate(CtorInfo.<wbr>Constructor, CtorInfo.FoundDecl,<br>
                              llvm::makeArrayRef(&Arg, NumArgs), OCS, true);<br>
+      else<br>
+        AddOverloadCandidate(M, Cand, llvm::makeArrayRef(&Arg, NumArgs), OCS,<br>
+                             true);<br>
     } else if (FunctionTemplateDecl *Tmpl =<br>
-                 dyn_cast<FunctionTemplateDecl><wbr>(Cand)) {<br>
+                 dyn_cast<FunctionTemplateDecl><wbr>(Cand->getUnderlyingDecl())) {<br>
       if (SM == CXXCopyAssignment || SM == CXXMoveAssignment)<br>
-        AddMethodTemplateCandidate(<wbr>Tmpl, DeclAccessPair::make(Tmpl, AS_public),<br>
-                                   RD, nullptr, ThisTy, Classification,<br>
-                                   llvm::makeArrayRef(&Arg, NumArgs),<br>
-                                   OCS, true);<br>
+        AddMethodTemplateCandidate(<br>
+            Tmpl, Cand, RD, nullptr, ThisTy, Classification,<br>
+            llvm::makeArrayRef(&Arg, NumArgs), OCS, true);<br>
+      else if (CtorInfo)<br>
+        AddTemplateOverloadCandidate(<br>
+            CtorInfo.ConstructorTmpl, CtorInfo.FoundDecl, nullptr,<br>
+            llvm::makeArrayRef(&Arg, NumArgs), OCS, true);<br>
       else<br>
-        AddTemplateOverloadCandidate(<wbr>Tmpl, DeclAccessPair::make(Tmpl, AS_public),<br>
-                                     nullptr, llvm::makeArrayRef(&Arg, NumArgs),<br>
-                                     OCS, true);<br>
+        AddTemplateOverloadCandidate(<br>
+            Tmpl, Cand, nullptr, llvm::makeArrayRef(&Arg, NumArgs), OCS, true);<br>
     } else {<br>
-      assert(isa<UsingDecl>(Cand) && "illegal Kind of operator = Decl");<br>
+      assert(isa<UsingDecl>(Cand.<wbr>getDecl()) &&<br>
+             "illegal Kind of operator = Decl");<br>
     }<br>
   }<br>
<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaOverload.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaOverload.cpp?rev=274049&<wbr>r1=274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaOverload.cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaOverload.cpp Tue Jun 28 14:03:57 2016<br>
@@ -3055,7 +3055,7 @@ IsInitializerListConstructorCo<wbr>nversion(S<br>
                                        bool AllowExplicit) {<br>
   for (auto *D : S.LookupConstructors(To)) {<br>
     auto Info = getConstructorInfo(D);<br>
-    if (!Info.Constructor)<br>
+    if (!Info)<br>
       continue;<br>
<br>
     bool Usable = !Info.Constructor-><wbr>isInvalidDecl() &&<br>
@@ -3174,7 +3174,7 @@ IsUserDefinedConversion(Sema &S, Expr *F<br>
<br>
       for (auto *D : S.LookupConstructors(<wbr>ToRecordDecl)) {<br>
         auto Info = getConstructorInfo(D);<br>
-        if (!Info.Constructor)<br>
+        if (!Info)<br>
           continue;<br>
<br>
         bool Usable = !Info.Constructor-><wbr>isInvalidDecl();<br>
@@ -8646,6 +8646,25 @@ bool clang::<wbr>isBetterOverloadCandidate(Se<br>
       return BetterTemplate == Cand1.Function-><wbr>getPrimaryTemplate();<br>
   }<br>
<br>
+  // FIXME: Work around a defect in the C++17 inheriting constructor wording.<br>
+  // A derived-class constructor beats an (inherited) base class constructor.<br>
+  bool Cand1IsInherited =<br>
+      dyn_cast_or_null<<wbr>ConstructorUsingShadowDecl>(<wbr>Cand1.FoundDecl.getDecl());<br>
+  bool Cand2IsInherited =<br>
+      dyn_cast_or_null<<wbr>ConstructorUsingShadowDecl>(<wbr>Cand2.FoundDecl.getDecl());<br>
+  if (Cand1IsInherited != Cand2IsInherited)<br>
+    return Cand2IsInherited;<br>
+  else if (Cand1IsInherited) {<br>
+    assert(Cand2IsInherited);<br>
+    auto *Cand1Class = cast<CXXRecordDecl>(Cand1.<wbr>Function->getDeclContext());<br>
+    auto *Cand2Class = cast<CXXRecordDecl>(Cand2.<wbr>Function->getDeclContext());<br>
+    if (Cand1Class->isDerivedFrom(<wbr>Cand2Class))<br>
+      return true;<br>
+    if (Cand2Class->isDerivedFrom(<wbr>Cand1Class))<br>
+      return false;<br>
+    // Inherited from sibling base classes: still ambiguous.<br>
+  }<br>
+<br>
   // Check for enable_if value-based overload resolution.<br>
   if (Cand1.Function && Cand2.Function) {<br>
     Comparison Cmp = compareEnableIfAttrs(S, Cand1.Function, Cand2.Function);<br>
@@ -8837,7 +8856,8 @@ enum OverloadCandidateKind {<br>
   oc_implicit_move_constructor,<br>
   oc_implicit_copy_assignment,<br>
   oc_implicit_move_assignment,<br>
-  oc_implicit_inherited_<wbr>constructor<br>
+  oc_inherited_constructor,<br>
+  oc_inherited_constructor_<wbr>template<br>
 };<br>
<br>
 OverloadCandidateKind ClassifyOverloadCandidate(Sema &S,<br>
@@ -8853,11 +8873,13 @@ OverloadCandidateKind ClassifyOverloadCa<br>
   }<br>
<br>
   if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(<wbr>Fn)) {<br>
-    if (!Ctor->isImplicit())<br>
-      return isTemplate ? oc_constructor_template : oc_constructor;<br>
-<br>
-    if (Ctor-><wbr>getInheritedConstructor())<br>
-      return oc_implicit_inherited_<wbr>constructor;<br>
+    if (!Ctor->isImplicit()) {<br>
+      if (isa<<wbr>ConstructorUsingShadowDecl>(<wbr>Found))<br>
+        return isTemplate ? oc_inherited_constructor_<wbr>template<br>
+                          : oc_inherited_constructor;<br>
+      else<br>
+        return isTemplate ? oc_constructor_template : oc_constructor;<br>
+    }<br>
<br>
     if (Ctor->isDefaultConstructor())<br>
       return oc_implicit_default_<wbr>constructor;<br>
@@ -8889,14 +8911,13 @@ OverloadCandidateKind ClassifyOverloadCa<br>
   return isTemplate ? oc_function_template : oc_function;<br>
 }<br>
<br>
-void MaybeEmitInheritedConstructorN<wbr>ote(Sema &S, Decl *Fn) {<br>
-  const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(<wbr>Fn);<br>
-  if (!Ctor) return;<br>
-<br>
-  Ctor = Ctor->getInheritedConstructor(<wbr>);<br>
-  if (!Ctor) return;<br>
-<br>
-  S.Diag(Ctor->getLocation(), diag::note_ovl_candidate_<wbr>inherited_constructor);<br>
+void MaybeEmitInheritedConstructorN<wbr>ote(Sema &S, Decl *FoundDecl) {<br>
+  // FIXME: It'd be nice to only emit a note once per using-decl per overload<br>
+  // set.<br>
+  if (auto *Shadow = dyn_cast<<wbr>ConstructorUsingShadowDecl>(<wbr>FoundDecl))<br>
+    S.Diag(FoundDecl->getLocation(<wbr>),<br>
+           diag::note_ovl_candidate_<wbr>inherited_constructor)<br>
+      << Shadow->getNominatedBaseClass(<wbr>);<br>
 }<br>
<br>
 } // end anonymous namespace<br>
@@ -8982,7 +9003,7 @@ void Sema::NoteOverloadCandidate(<wbr>NamedDe<br>
<br>
   HandleFunctionTypeMismatch(PD, Fn->getType(), DestType);<br>
   Diag(Fn->getLocation(), PD);<br>
-  MaybeEmitInheritedConstructorN<wbr>ote(*this, Fn);<br>
+  MaybeEmitInheritedConstructorN<wbr>ote(*this, Found);<br>
 }<br>
<br>
 // Notes the location of all overload candidates designated through<br>
@@ -9070,7 +9091,7 @@ static void DiagnoseBadConversion(Sema &<br>
       << (unsigned) FnKind << FnDesc<br>
       << (FromExpr ? FromExpr->getSourceRange() : SourceRange())<br>
       << ToTy << Name << I+1;<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
     return;<br>
   }<br>
<br>
@@ -9101,7 +9122,7 @@ static void DiagnoseBadConversion(Sema &<br>
         << FromTy<br>
         << FromQs.getAddressSpace() << ToQs.getAddressSpace()<br>
         << (unsigned) isObjectArgument << I+1;<br>
-      MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+      MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
       return;<br>
     }<br>
<br>
@@ -9112,7 +9133,7 @@ static void DiagnoseBadConversion(Sema &<br>
         << FromTy<br>
         << FromQs.getObjCLifetime() << ToQs.getObjCLifetime()<br>
         << (unsigned) isObjectArgument << I+1;<br>
-      MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+      MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
       return;<br>
     }<br>
<br>
@@ -9123,7 +9144,7 @@ static void DiagnoseBadConversion(Sema &<br>
       << FromTy<br>
       << FromQs.getObjCGCAttr() << ToQs.getObjCGCAttr()<br>
       << (unsigned) isObjectArgument << I+1;<br>
-      MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+      MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
       return;<br>
     }<br>
<br>
@@ -9132,7 +9153,7 @@ static void DiagnoseBadConversion(Sema &<br>
         << (unsigned) FnKind << FnDesc<br>
         << (FromExpr ? FromExpr->getSourceRange() : SourceRange())<br>
         << FromTy << FromQs.hasUnaligned() << I+1;<br>
-      MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+      MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
       return;<br>
     }<br>
<br>
@@ -9150,7 +9171,7 @@ static void DiagnoseBadConversion(Sema &<br>
         << (FromExpr ? FromExpr->getSourceRange() : SourceRange())<br>
         << FromTy << (CVR - 1) << I+1;<br>
     }<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
     return;<br>
   }<br>
<br>
@@ -9161,7 +9182,7 @@ static void DiagnoseBadConversion(Sema &<br>
       << (unsigned) FnKind << FnDesc<br>
       << (FromExpr ? FromExpr->getSourceRange() : SourceRange())<br>
       << FromTy << ToTy << (unsigned) isObjectArgument << I+1;<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
     return;<br>
   }<br>
<br>
@@ -9179,7 +9200,7 @@ static void DiagnoseBadConversion(Sema &<br>
       << FromTy << ToTy << (unsigned) isObjectArgument << I+1<br>
       << (unsigned) (Cand->Fix.Kind);<br>
<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
     return;<br>
   }<br>
<br>
@@ -9218,7 +9239,7 @@ static void DiagnoseBadConversion(Sema &<br>
         << (unsigned) FnKind << FnDesc<br>
         << (FromExpr ? FromExpr->getSourceRange() : SourceRange())<br>
         << (unsigned) isObjectArgument << I + 1;<br>
-      MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+      MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
       return;<br>
     }<br>
   }<br>
@@ -9230,7 +9251,7 @@ static void DiagnoseBadConversion(Sema &<br>
       << (FromExpr ? FromExpr->getSourceRange() : SourceRange())<br>
       << (BaseToDerivedConversion - 1)<br>
       << FromTy << ToTy << I+1;<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
     return;<br>
   }<br>
<br>
@@ -9243,7 +9264,7 @@ static void DiagnoseBadConversion(Sema &<br>
         << (unsigned) FnKind << FnDesc<br>
         << (FromExpr ? FromExpr->getSourceRange() : SourceRange())<br>
         << FromTy << ToTy << (unsigned) isObjectArgument << I+1;<br>
-        MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+        MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
         return;<br>
       }<br>
   }<br>
@@ -9265,7 +9286,7 @@ static void DiagnoseBadConversion(Sema &<br>
     FDiag << *HI;<br>
   S.Diag(Fn->getLocation(), FDiag);<br>
<br>
-  MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+  MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
 }<br>
<br>
 /// Additional arity mismatch diagnosis specific to a function overload<br>
@@ -9341,7 +9362,7 @@ static void DiagnoseArityMismatch(Sema &<br>
     S.Diag(Fn->getLocation(), diag::note_ovl_candidate_<wbr>arity)<br>
       << (unsigned) FnKind << (Fn-><wbr>getDescribedFunctionTemplate() != nullptr)<br>
       << mode << modeCount << NumFormalArgs;<br>
-  MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+  MaybeEmitInheritedConstructorN<wbr>ote(S, Found);<br>
 }<br>
<br>
 /// Arity mismatch diagnosis specific to a function overload candidate.<br>
@@ -9377,7 +9398,7 @@ static void DiagnoseBadDeduction(Sema &S<br>
     S.Diag(Templated->getLocation(<wbr>),<br>
            diag::note_ovl_candidate_<wbr>incomplete_deduction)<br>
         << ParamD->getDeclName();<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Templated);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Found);<br>
     return;<br>
   }<br>
<br>
@@ -9402,7 +9423,7 @@ static void DiagnoseBadDeduction(Sema &S<br>
<br>
     S.Diag(Templated->getLocation(<wbr>), diag::note_ovl_candidate_<wbr>underqualified)<br>
         << ParamD->getDeclName() << Arg << NonCanonParam;<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Templated);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Found);<br>
     return;<br>
   }<br>
<br>
@@ -9421,7 +9442,7 @@ static void DiagnoseBadDeduction(Sema &S<br>
            diag::note_ovl_candidate_<wbr>inconsistent_deduction)<br>
         << which << ParamD->getDeclName() << *DeductionFailure.getFirstArg(<wbr>)<br>
         << *DeductionFailure.<wbr>getSecondArg();<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Templated);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Found);<br>
     return;<br>
   }<br>
<br>
@@ -9444,7 +9465,7 @@ static void DiagnoseBadDeduction(Sema &S<br>
              diag::note_ovl_candidate_<wbr>explicit_arg_mismatch_unnamed)<br>
           << (index + 1);<br>
     }<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Templated);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Found);<br>
     return;<br>
<br>
   case Sema::TDK_TooManyArguments:<br>
@@ -9455,7 +9476,7 @@ static void DiagnoseBadDeduction(Sema &S<br>
   case Sema::TDK_InstantiationDepth:<br>
     S.Diag(Templated->getLocation(<wbr>),<br>
            diag::note_ovl_candidate_<wbr>instantiation_depth);<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Templated);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Found);<br>
     return;<br>
<br>
   case Sema::TDK_SubstitutionFailure: {<br>
@@ -9493,7 +9514,7 @@ static void DiagnoseBadDeduction(Sema &S<br>
     S.Diag(Templated->getLocation(<wbr>),<br>
            diag::note_ovl_candidate_<wbr>substitution_failure)<br>
         << TemplateArgString << SFINAEArgString << R;<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Templated);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Found);<br>
     return;<br>
   }<br>
<br>
@@ -9565,7 +9586,7 @@ static void DiagnoseBadDeduction(Sema &S<br>
   // note_ovl_candidate_bad_<wbr>deduction, which is uselessly vague.<br>
   case Sema::TDK_<wbr>MiscellaneousDeductionFailure:<br>
     S.Diag(Templated->getLocation(<wbr>), diag::note_ovl_candidate_bad_<wbr>deduction);<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Templated);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Found);<br>
     return;<br>
   }<br>
 }<br>
@@ -9676,7 +9697,7 @@ static void NoteFunctionCandidate(Sema &<br>
     S.Diag(Fn->getLocation(), diag::note_ovl_candidate_<wbr>deleted)<br>
       << FnKind << FnDesc<br>
       << (Fn->isDeleted() ? (Fn->isDeletedAsWritten() ? 1 : 2) : 0);<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
     return;<br>
   }<br>
<br>
@@ -9698,7 +9719,7 @@ static void NoteFunctionCandidate(Sema &<br>
   case ovl_fail_illegal_constructor: {<br>
     S.Diag(Fn->getLocation(), diag::note_ovl_candidate_<wbr>illegal_constructor)<br>
       << (Fn->getPrimaryTemplate() ? 1 : 0);<br>
-    MaybeEmitInheritedConstructorN<wbr>ote(S, Fn);<br>
+    MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->FoundDecl);<br>
     return;<br>
   }<br>
<br>
@@ -9764,7 +9785,6 @@ static void NoteSurrogateCandidate(Sema<br>
<br>
   S.Diag(Cand->Surrogate-><wbr>getLocation(), diag::note_ovl_surrogate_cand)<br>
     << FnType;<br>
-  MaybeEmitInheritedConstructorN<wbr>ote(S, Cand->Surrogate);<br>
 }<br>
<br>
 static void NoteBuiltinOperatorCandidate(<wbr>Sema &S, StringRef Opc,<br>
@@ -10531,9 +10551,10 @@ private:<br>
     UnresolvedSetIterator Result = S.getMostSpecialized(<br>
         MatchesCopy.begin(), MatchesCopy.end(), FailedCandidates,<br>
         SourceExpr->getLocStart(), S.PDiag(),<br>
-        S.PDiag(diag::err_addr_ovl_<wbr>ambiguous) << Matches[0]<br>
-                                                     .second->getDeclName(),<br>
-        S.PDiag(diag::note_ovl_<wbr>candidate) << (unsigned)oc_function_<wbr>template,<br>
+        S.PDiag(diag::err_addr_ovl_<wbr>ambiguous)<br>
+          << Matches[0].second-><wbr>getDeclName(),<br>
+        S.PDiag(diag::note_ovl_<wbr>candidate)<br>
+          << (unsigned)oc_function_<wbr>template,<br>
         Complain, TargetFunctionType);<br>
<br>
     if (Result != MatchesCopy.end()) {<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp?rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -1843,36 +1843,6 @@ TemplateDeclInstantiator::<wbr>VisitCXXMethod<br>
                                         Constructor->isExplicit(),<br>
                                         Constructor-><wbr>isInlineSpecified(),<br>
                                         false, Constructor->isConstexpr());<br>
-<br>
-    // Claim that the instantiation of a constructor or constructor template<br>
-    // inherits the same constructor that the template does.<br>
-    if (CXXConstructorDecl *Inh = const_cast<CXXConstructorDecl *>(<br>
-            Constructor-><wbr>getInheritedConstructor())) {<br>
-      // If we're instantiating a specialization of a function template, our<br>
-      // "inherited constructor" will actually itself be a function template.<br>
-      // Instantiate a declaration of it, too.<br>
-      if (FunctionTemplate) {<br>
-        assert(!TemplateParams && Inh-><wbr>getDescribedFunctionTemplate() &&<br>
-               !Inh->getParent()-><wbr>isDependentContext() &&<br>
-               "inheriting constructor template in dependent context?");<br>
-        Sema::InstantiatingTemplate Inst(SemaRef, Constructor->getLocation(),<br>
-                                         Inh);<br>
-        if (Inst.isInvalid())<br>
-          return nullptr;<br>
-        Sema::ContextRAII SavedContext(SemaRef, Inh->getDeclContext());<br>
-        LocalInstantiationScope LocalScope(SemaRef);<br>
-<br>
-        // Use the same template arguments that we deduced for the inheriting<br>
-        // constructor. There's no way they could be deduced differently.<br>
-        MultiLevelTemplateArgumentList InheritedArgs;<br>
-        InheritedArgs.<wbr>addOuterTemplateArguments(<wbr>TemplateArgs.getInnermost());<br>
-        Inh = cast_or_null<<wbr>CXXConstructorDecl>(<br>
-            SemaRef.SubstDecl(Inh, Inh->getDeclContext(), InheritedArgs));<br>
-        if (!Inh)<br>
-          return nullptr;<br>
-      }<br>
-      cast<CXXConstructorDecl>(<wbr>Method)-><wbr>setInheritedConstructor(Inh);<br>
-    }<br>
   } else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(D)<wbr>) {<br>
     Method = CXXDestructorDecl::Create(<wbr>SemaRef.Context, Record,<br>
                                        StartLoc, NameInfo, T, TInfo,<br>
@@ -2398,9 +2368,14 @@ Decl *TemplateDeclInstantiator::<wbr>VisitUsi<br>
   if (!QualifierLoc)<br>
     return nullptr;<br>
<br>
-  // The name info is non-dependent, so no transformation<br>
-  // is required.<br>
+  // For an inheriting constructor declaration, the name of the using<br>
+  // declaration is the name of a constructor in this class, not in the<br>
+  // base class.<br>
   DeclarationNameInfo NameInfo = D->getNameInfo();<br>
+  if (NameInfo.getName().<wbr>getNameKind() == DeclarationName::<wbr>CXXConstructorName)<br>
+    if (auto *RD = dyn_cast<CXXRecordDecl>(<wbr>SemaRef.CurContext))<br>
+      NameInfo.setName(SemaRef.<wbr>Context.DeclarationNames.<wbr>getCXXConstructorName(<br>
+          SemaRef.Context.<wbr>getCanonicalType(SemaRef.<wbr>Context.getRecordType(RD))));<br>
<br>
   // We only need to do redeclaration lookups if we're in a class<br>
   // scope (in fact, it's not really even possible in non-class<br>
@@ -2443,18 +2418,23 @@ Decl *TemplateDeclInstantiator::<wbr>VisitUsi<br>
   if (NewUD->isInvalidDecl())<br>
     return NewUD;<br>
<br>
-  if (NameInfo.getName().<wbr>getNameKind() == DeclarationName::<wbr>CXXConstructorName) {<br>
+  if (NameInfo.getName().<wbr>getNameKind() == DeclarationName::<wbr>CXXConstructorName)<br>
     SemaRef.<wbr>CheckInheritingConstructorUsin<wbr>gDecl(NewUD);<br>
-    return NewUD;<br>
-  }<br>
<br>
   bool isFunctionScope = Owner->isFunctionOrMethod();<br>
<br>
   // Process the shadow decls.<br>
   for (auto *Shadow : D->shadows()) {<br>
+    // FIXME: UsingShadowDecl doesn't preserve its immediate target, so<br>
+    // reconstruct it in the case where it matters.<br>
+    NamedDecl *OldTarget = Shadow->getTargetDecl();<br>
+    if (auto *CUSD = dyn_cast<<wbr>ConstructorUsingShadowDecl>(<wbr>Shadow))<br>
+      if (auto *BaseShadow = CUSD-><wbr>getNominatedBaseClassShadowDec<wbr>l())<br>
+        OldTarget = BaseShadow;<br>
+<br>
     NamedDecl *InstTarget =<br>
         cast_or_null<NamedDecl>(<wbr>SemaRef.FindInstantiatedDecl(<br>
-            Shadow->getLocation(), Shadow->getTargetDecl(), TemplateArgs));<br>
+            Shadow->getLocation(), OldTarget, TemplateArgs));<br>
     if (!InstTarget)<br>
       return nullptr;<br>
<br>
@@ -2484,6 +2464,12 @@ Decl *TemplateDeclInstantiator::<wbr>VisitUsi<br>
   // Ignore these;  we handle them in bulk when processing the UsingDecl.<br>
   return nullptr;<br>
 }<br>
+<br>
+Decl *TemplateDeclInstantiator::<wbr>VisitConstructorUsingShadowDec<wbr>l(<br>
+    ConstructorUsingShadowDecl *D) {<br>
+  // Ignore these;  we handle them in bulk when processing the UsingDecl.<br>
+  return nullptr;<br>
+}<br>
<br>
 Decl * TemplateDeclInstantiator<br>
     ::<wbr>VisitUnresolvedUsingTypenameDe<wbr>cl(UnresolvedUsingTypenameDecl *D) {<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>TreeTransform.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>TreeTransform.h?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>TreeTransform.h (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>TreeTransform.h Tue Jun 28 14:03:57 2016<br>
@@ -2690,6 +2690,16 @@ public:<br>
                                            ParenRange);<br>
   }<br>
<br>
+  /// \brief Build a new implicit construction via inherited constructor<br>
+  /// expression.<br>
+  ExprResult RebuildCXXInheritedCtorInitExp<wbr>r(QualType T, SourceLocation Loc,<br>
+                                             CXXConstructorDecl *Constructor,<br>
+                                             bool ConstructsVBase,<br>
+                                             bool InheritedFromVBase) {<br>
+    return new (getSema().Context) CXXInheritedCtorInitExpr(<br>
+        Loc, T, Constructor, ConstructsVBase, InheritedFromVBase);<br>
+  }<br>
+<br>
   /// \brief Build a new object-construction expression.<br>
   ///<br>
   /// By default, performs semantic analysis to build the new expression.<br>
@@ -9937,6 +9947,32 @@ TreeTransform<Derived>::<wbr>TransformCXXCons<br>
                                               E->getParenOrBraceRange());<br>
 }<br>
<br>
+template<typename Derived><br>
+ExprResult TreeTransform<Derived>::<wbr>TransformCXXInheritedCtorInitE<wbr>xpr(<br>
+    CXXInheritedCtorInitExpr *E) {<br>
+  QualType T = getDerived().TransformType(E-><wbr>getType());<br>
+  if (T.isNull())<br>
+    return ExprError();<br>
+<br>
+  CXXConstructorDecl *Constructor = cast_or_null<<wbr>CXXConstructorDecl>(<br>
+      getDerived().TransformDecl(E-><wbr>getLocStart(), E->getConstructor()));<br>
+  if (!Constructor)<br>
+    return ExprError();<br>
+<br>
+  if (!getDerived().AlwaysRebuild() &&<br>
+      T == E->getType() &&<br>
+      Constructor == E->getConstructor()) {<br>
+    // Mark the constructor as referenced.<br>
+    // FIXME: Instantiation-specific<br>
+    SemaRef.<wbr>MarkFunctionReferenced(E-><wbr>getLocStart(), Constructor);<br>
+    return E;<br>
+  }<br>
+<br>
+  return getDerived().<wbr>RebuildCXXInheritedCtorInitExp<wbr>r(<br>
+      T, E->getLocation(), Constructor,<br>
+      E->constructsVBase(), E->inheritedFromVBase());<br>
+}<br>
+<br>
 /// \brief Transform a C++ temporary-binding expression.<br>
 ///<br>
 /// Since CXXBindTemporaryExpr nodes are implicitly generated, we just<br>
<br>
Modified: cfe/trunk/lib/Serialization/<wbr>ASTCommon.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTCommon.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>Serialization/ASTCommon.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/<wbr>ASTCommon.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/<wbr>ASTCommon.cpp Tue Jun 28 14:03:57 2016<br>
@@ -258,6 +258,7 @@ bool serialization::<wbr>isRedeclarableDeclKi<br>
   case Decl::CXXDestructor:<br>
   case Decl::CXXConversion:<br>
   case Decl::UsingShadow:<br>
+  case Decl::ConstructorUsingShadow:<br>
   case Decl::Var:<br>
   case Decl::FunctionTemplate:<br>
   case Decl::ClassTemplate:<br>
<br>
Modified: cfe/trunk/lib/Serialization/<wbr>ASTReaderDecl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>Serialization/ASTReaderDecl.<wbr>cpp?rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/<wbr>ASTReaderDecl.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/<wbr>ASTReaderDecl.cpp Tue Jun 28 14:03:57 2016<br>
@@ -324,6 +324,7 @@ namespace clang {<br>
     void VisitTypeAliasTemplateDecl(<wbr>TypeAliasTemplateDecl *D);<br>
     void VisitUsingDecl(UsingDecl *D);<br>
     void VisitUsingShadowDecl(<wbr>UsingShadowDecl *D);<br>
+    void VisitConstructorUsingShadowDec<wbr>l(ConstructorUsingShadowDecl *D);<br>
     void VisitLinkageSpecDecl(<wbr>LinkageSpecDecl *D);<br>
     void VisitFileScopeAsmDecl(<wbr>FileScopeAsmDecl *AD);<br>
     void VisitImportDecl(ImportDecl *D);<br>
@@ -1421,6 +1422,16 @@ void ASTDeclReader::<wbr>VisitUsingShadowDecl<br>
   mergeRedeclarable(D, Redecl);<br>
 }<br>
<br>
+void ASTDeclReader::<wbr>VisitConstructorUsingShadowDec<wbr>l(<br>
+    ConstructorUsingShadowDecl *D) {<br>
+  VisitUsingShadowDecl(D);<br>
+  D-><wbr>NominatedBaseClassShadowDecl =<br>
+      ReadDeclAs<<wbr>ConstructorUsingShadowDecl>(<wbr>Record, Idx);<br>
+  D-><wbr>ConstructedBaseClassShadowDecl =<br>
+      ReadDeclAs<<wbr>ConstructorUsingShadowDecl>(<wbr>Record, Idx);<br>
+  D->IsVirtual = Record[Idx++];<br>
+}<br>
+<br>
 void ASTDeclReader::<wbr>VisitUsingDirectiveDecl(<wbr>UsingDirectiveDecl *D) {<br>
   VisitNamedDecl(D);<br>
   D->UsingLoc = ReadSourceLocation(Record, Idx);<br>
@@ -1768,11 +1779,17 @@ void ASTDeclReader::<wbr>VisitCXXMethodDecl(C<br>
 }<br>
<br>
 void ASTDeclReader::<wbr>VisitCXXConstructorDecl(<wbr>CXXConstructorDecl *D) {<br>
+  // We need the inherited constructor information to merge the declaration,<br>
+  // so we have to read it before we call VisitCXXMethodDecl.<br>
+  if (D->isInheritingConstructor()) {<br>
+    auto *Shadow = ReadDeclAs<<wbr>ConstructorUsingShadowDecl>(<wbr>Record, Idx);<br>
+    auto *Ctor = ReadDeclAs<CXXConstructorDecl><wbr>(Record, Idx);<br>
+    *D->getTrailingObjects<<wbr>InheritedConstructor>() =<br>
+        InheritedConstructor(Shadow, Ctor);<br>
+  }<br>
+<br>
   VisitCXXMethodDecl(D);<br>
<br>
-  if (auto *CD = ReadDeclAs<CXXConstructorDecl><wbr>(Record, Idx))<br>
-    if (D->isCanonicalDecl())<br>
-      D->setInheritedConstructor(CD-<wbr>>getCanonicalDecl());<br>
   D->IsExplicitSpecified = Record[Idx++];<br>
 }<br>
<br>
@@ -2663,6 +2680,13 @@ static bool isSameEntity(NamedDecl *X, N<br>
   // functions, etc.<br>
   if (FunctionDecl *FuncX = dyn_cast<FunctionDecl>(X)) {<br>
     FunctionDecl *FuncY = cast<FunctionDecl>(Y);<br>
+    if (CXXConstructorDecl *CtorX = dyn_cast<CXXConstructorDecl>(<wbr>X)) {<br>
+      CXXConstructorDecl *CtorY = cast<CXXConstructorDecl>(Y);<br>
+      if (CtorX-><wbr>getInheritedConstructor() &&<br>
+          !isSameEntity(CtorX-><wbr>getInheritedConstructor().<wbr>getConstructor(),<br>
+                        CtorY-><wbr>getInheritedConstructor().<wbr>getConstructor()))<br>
+        return false;<br>
+    }<br>
     return (FuncX->getLinkageInternal() == FuncY->getLinkageInternal()) &&<br>
       FuncX->getASTContext().<wbr>hasSameType(FuncX->getType(), FuncY->getType());<br>
   }<br>
@@ -3240,6 +3264,9 @@ Decl *ASTReader::ReadDeclRecord(<wbr>DeclID I<br>
   case DECL_USING_SHADOW:<br>
     D = UsingShadowDecl::<wbr>CreateDeserialized(Context, ID);<br>
     break;<br>
+  case DECL_CONSTRUCTOR_USING_SHADOW:<br>
+    D = ConstructorUsingShadowDecl::<wbr>CreateDeserialized(Context, ID);<br>
+    break;<br>
   case DECL_USING_DIRECTIVE:<br>
     D = UsingDirectiveDecl::<wbr>CreateDeserialized(Context, ID);<br>
     break;<br>
@@ -3256,7 +3283,10 @@ Decl *ASTReader::ReadDeclRecord(<wbr>DeclID I<br>
     D = CXXMethodDecl::<wbr>CreateDeserialized(Context, ID);<br>
     break;<br>
   case DECL_CXX_CONSTRUCTOR:<br>
-    D = CXXConstructorDecl::<wbr>CreateDeserialized(Context, ID);<br>
+    D = CXXConstructorDecl::<wbr>CreateDeserialized(Context, ID, false);<br>
+    break;<br>
+  case DECL_CXX_INHERITED_<wbr>CONSTRUCTOR:<br>
+    D = CXXConstructorDecl::<wbr>CreateDeserialized(Context, ID, true);<br>
     break;<br>
   case DECL_CXX_DESTRUCTOR:<br>
     D = CXXDestructorDecl::<wbr>CreateDeserialized(Context, ID);<br>
<br>
Modified: cfe/trunk/lib/Serialization/<wbr>ASTReaderStmt.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>Serialization/ASTReaderStmt.<wbr>cpp?rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/<wbr>ASTReaderStmt.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/<wbr>ASTReaderStmt.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1250,6 +1250,14 @@ void ASTStmtReader::<wbr>VisitCXXConstructExp<br>
   E->ParenOrBraceRange = ReadSourceRange(Record, Idx);<br>
 }<br>
<br>
+void ASTStmtReader::<wbr>VisitCXXInheritedCtorInitExpr(<wbr>CXXInheritedCtorInitExpr *E) {<br>
+  VisitExpr(E);<br>
+  E->Constructor = ReadDeclAs<CXXConstructorDecl><wbr>(Record, Idx);<br>
+  E->Loc = ReadSourceLocation(Record, Idx);<br>
+  E->ConstructsVirtualBase = Record[Idx++];<br>
+  E->InheritedFromVirtualBase = Record[Idx++];<br>
+}<br>
+<br>
 void ASTStmtReader::<wbr>VisitCXXTemporaryObjectExpr(<wbr>CXXTemporaryObjectExpr *E) {<br>
   VisitCXXConstructExpr(E);<br>
   E->Type = GetTypeSourceInfo(Record, Idx);<br>
@@ -3407,6 +3415,10 @@ Stmt *ASTReader::<wbr>ReadStmtFromStream(Modu<br>
       S = new (Context) CXXConstructExpr(Empty);<br>
       break;<br>
<br>
+    case EXPR_CXX_INHERITED_CTOR_INIT:<br>
+      S = new (Context) CXXInheritedCtorInitExpr(<wbr>Empty);<br>
+      break;<br>
+<br>
     case EXPR_CXX_TEMPORARY_OBJECT:<br>
       S = new (Context) CXXTemporaryObjectExpr(Empty);<br>
       break;<br>
<br>
Modified: cfe/trunk/lib/Serialization/<wbr>ASTWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>Serialization/ASTWriter.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/<wbr>ASTWriter.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/<wbr>ASTWriter.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1104,6 +1104,7 @@ void ASTWriter::<wbr>WriteBlockInfoBlock() {<br>
   RECORD(DECL_CXX_RECORD);<br>
   RECORD(DECL_CXX_METHOD);<br>
   RECORD(DECL_CXX_CONSTRUCTOR);<br>
+  RECORD(DECL_CXX_INHERITED_<wbr>CONSTRUCTOR);<br>
   RECORD(DECL_CXX_DESTRUCTOR);<br>
   RECORD(DECL_CXX_CONVERSION);<br>
   RECORD(DECL_ACCESS_SPEC);<br>
<br>
Modified: cfe/trunk/lib/Serialization/<wbr>ASTWriterDecl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>Serialization/ASTWriterDecl.<wbr>cpp?rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/<wbr>ASTWriterDecl.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/<wbr>ASTWriterDecl.cpp Tue Jun 28 14:03:57 2016<br>
@@ -107,6 +107,7 @@ namespace clang {<br>
     void VisitTypeAliasTemplateDecl(<wbr>TypeAliasTemplateDecl *D);<br>
     void VisitUsingDecl(UsingDecl *D);<br>
     void VisitUsingShadowDecl(<wbr>UsingShadowDecl *D);<br>
+    void VisitConstructorUsingShadowDec<wbr>l(ConstructorUsingShadowDecl *D);<br>
     void VisitLinkageSpecDecl(<wbr>LinkageSpecDecl *D);<br>
     void VisitFileScopeAsmDecl(<wbr>FileScopeAsmDecl *D);<br>
     void VisitImportDecl(ImportDecl *D);<br>
@@ -1126,6 +1127,15 @@ void ASTDeclWriter::<wbr>VisitUsingShadowDecl<br>
   Code = serialization::DECL_USING_<wbr>SHADOW;<br>
 }<br>
<br>
+void ASTDeclWriter::<wbr>VisitConstructorUsingShadowDec<wbr>l(<br>
+    ConstructorUsingShadowDecl *D) {<br>
+  VisitUsingShadowDecl(D);<br>
+  Record.AddDeclRef(D-><wbr>NominatedBaseClassShadowDecl);<br>
+  Record.AddDeclRef(D-><wbr>ConstructedBaseClassShadowDecl<wbr>);<br>
+  Record.push_back(D->IsVirtual)<wbr>;<br>
+  Code = serialization::DECL_<wbr>CONSTRUCTOR_USING_SHADOW;<br>
+}<br>
+<br>
 void ASTDeclWriter::<wbr>VisitUsingDirectiveDecl(<wbr>UsingDirectiveDecl *D) {<br>
   VisitNamedDecl(D);<br>
   Record.AddSourceLocation(D-><wbr>getUsingLoc());<br>
@@ -1211,12 +1221,21 @@ void ASTDeclWriter::<wbr>VisitCXXMethodDecl(C<br>
 }<br>
<br>
 void ASTDeclWriter::<wbr>VisitCXXConstructorDecl(<wbr>CXXConstructorDecl *D) {<br>
+  if (auto Inherited = D->getInheritedConstructor()) {<br>
+    Record.AddDeclRef(Inherited.<wbr>getShadowDecl());<br>
+    Record.AddDeclRef(Inherited.<wbr>getConstructor());<br>
+    Code = serialization::DECL_CXX_<wbr>INHERITED_CONSTRUCTOR;<br>
+  } else {<br>
+    Code = serialization::DECL_CXX_<wbr>CONSTRUCTOR;<br>
+  }<br>
+<br>
   VisitCXXMethodDecl(D);<br>
<br>
-  Record.AddDeclRef(D-><wbr>getInheritedConstructor());<br>
   Record.push_back(D-><wbr>IsExplicitSpecified);<br>
<br>
-  Code = serialization::DECL_CXX_<wbr>CONSTRUCTOR;<br>
+  Code = D->isInheritingConstructor()<br>
+             ? serialization::DECL_CXX_<wbr>INHERITED_CONSTRUCTOR<br>
+             : serialization::DECL_CXX_<wbr>CONSTRUCTOR;<br>
 }<br>
<br>
 void ASTDeclWriter::<wbr>VisitCXXDestructorDecl(<wbr>CXXDestructorDecl *D) {<br>
<br>
Modified: cfe/trunk/lib/Serialization/<wbr>ASTWriterStmt.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>Serialization/ASTWriterStmt.<wbr>cpp?rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/<wbr>ASTWriterStmt.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/<wbr>ASTWriterStmt.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1218,6 +1218,15 @@ void ASTStmtWriter::<wbr>VisitCXXConstructExp<br>
   Code = serialization::EXPR_CXX_<wbr>CONSTRUCT;<br>
 }<br>
<br>
+void ASTStmtWriter::<wbr>VisitCXXInheritedCtorInitExpr(<wbr>CXXInheritedCtorInitExpr *E) {<br>
+  VisitExpr(E);<br>
+  Record.AddDeclRef(E-><wbr>getConstructor());<br>
+  Record.AddSourceLocation(E-><wbr>getLocation());<br>
+  Record.push_back(E-><wbr>constructsVBase());<br>
+  Record.push_back(E-><wbr>inheritedFromVBase());<br>
+  Code = serialization::EXPR_CXX_<wbr>INHERITED_CTOR_INIT;<br>
+}<br>
+<br>
 void ASTStmtWriter::<wbr>VisitCXXTemporaryObjectExpr(<wbr>CXXTemporaryObjectExpr *E) {<br>
   VisitCXXConstructExpr(E);<br>
   Record.AddTypeSourceInfo(E-><wbr>getTypeSourceInfo());<br>
<br>
Modified: cfe/trunk/lib/StaticAnalyzer/<wbr>Core/ExprEngine.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>StaticAnalyzer/Core/<wbr>ExprEngine.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/StaticAnalyzer/<wbr>Core/ExprEngine.cpp (original)<br>
+++ cfe/trunk/lib/StaticAnalyzer/<wbr>Core/ExprEngine.cpp Tue Jun 28 14:03:57 2016<br>
@@ -755,6 +755,7 @@ void ExprEngine::Visit(const Stmt *S, Ex<br>
     // C++ and ARC stuff we don't support yet.<br>
     case Expr::<wbr>ObjCIndirectCopyRestoreExprCla<wbr>ss:<br>
     case Stmt::<wbr>CXXDependentScopeMemberExprCla<wbr>ss:<br>
+    case Stmt::<wbr>CXXInheritedCtorInitExprClass:<br>
     case Stmt::CXXTryStmtClass:<br>
     case Stmt::CXXTypeidExprClass:<br>
     case Stmt::CXXUuidofExprClass:<br>
<br>
Modified: cfe/trunk/test/CXX/basic/<wbr>basic.lookup/basic.lookup.<wbr>qual/class.qual/p2.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>basic/basic.lookup/basic.<wbr>lookup.qual/class.qual/p2.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/basic/<wbr>basic.lookup/basic.lookup.<wbr>qual/class.qual/p2.cpp (original)<br>
+++ cfe/trunk/test/CXX/basic/<wbr>basic.lookup/basic.lookup.<wbr>qual/class.qual/p2.cpp Tue Jun 28 14:03:57 2016<br>
@@ -53,16 +53,17 @@ namespace InhCtor {<br>
   int n = b.T(); // expected-error {{'T' is a protected member of 'InhCtor::A'}}<br>
                  // expected-note@-15 {{declared protected here}}<br>
<br>
+  // FIXME: EDG and GCC reject this too, but it's not clear why it would be<br>
+  // ill-formed.<br>
   template<typename T><br>
   struct S : T {<br>
-    struct U : S {<br>
+    struct U : S { // expected-note 6{{candidate}}<br>
       using S::S;<br>
     };<br>
     using T::T;<br>
   };<br>
-<br>
-  S<A>::U ua(0);<br>
-  S<B>::U ub(0);<br>
+  S<A>::U ua(0); // expected-error {{no match}}<br>
+  S<B>::U ub(0); // expected-error {{no match}}<br>
<br>
   template<typename T><br>
   struct X : T {<br>
<br>
Modified: cfe/trunk/test/CXX/basic/<wbr>basic.types/p10.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.types/p10.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>basic/basic.types/p10.cpp?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/basic/<wbr>basic.types/p10.cpp (original)<br>
+++ cfe/trunk/test/CXX/basic/<wbr>basic.types/p10.cpp Tue Jun 28 14:03:57 2016<br>
@@ -141,3 +141,45 @@ constexpr int arb(int n) {<br>
 }<br>
 constexpr long Overflow[ // expected-error {{constexpr variable cannot have non-literal type 'long const[(1 << 30) << 2]'}}<br>
     (1 << 30) << 2]{};   // expected-warning {{requires 34 bits to represent}}<br>
+<br>
+namespace inherited_ctor {<br>
+  struct A { constexpr A(int); };<br>
+  struct B : A {<br>
+    B();<br>
+    using A::A;<br>
+  };<br>
+  constexpr int f(B) { return 0; } // ok<br>
+<br>
+  struct C { constexpr C(int); };<br>
+  struct D : C { // expected-note {{because}}<br>
+    D(int);<br>
+    using C::C;<br>
+  };<br>
+  constexpr int f(D) { return 0; } // expected-error {{not a literal type}}<br>
+<br>
+  // This one is a bit odd: F inherits E's default constructor, which is<br>
+  // constexpr. Because F has a constructor of its own, it doesn't declare a<br>
+  // default constructor hiding E's one.<br>
+  struct E {};<br>
+  struct F : E {<br>
+    F(int);<br>
+    using E::E;<br>
+  };<br>
+  constexpr int f(F) { return 0; }<br>
+<br>
+  // FIXME: Is this really the right behavior? We presumably should be checking<br>
+  // whether the inherited constructor would be a copy or move constructor for<br>
+  // the derived class, not for the base class.<br>
+  struct G { constexpr G(const G&); };<br>
+  struct H : G { // expected-note {{because}}<br>
+    using G::G;<br>
+  };<br>
+  constexpr int f(H) { return 0; } // expected-error {{not a literal type}}<br>
+<br>
+  struct J;<br>
+  struct I { constexpr I(const J&); };<br>
+  struct J : I {<br>
+    using I::I;<br>
+  };<br>
+  constexpr int f(J) { return 0; }<br>
+}<br>
<br>
Added: cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p15.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp?rev=274049&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>dcl.dcl/basic.namespace/<wbr>namespace.udecl/p15.cpp?rev=<wbr>274049&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p15.cpp (added)<br>
+++ cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p15.cpp Tue Jun 28 14:03:57 2016<br>
@@ -0,0 +1,81 @@<br>
+// RUN: %clang_cc1 -std=c++11 -verify %s<br>
+<br>
+struct B1 { // expected-note 2{{candidate}}<br>
+  B1(int); // expected-note {{candidate}}<br>
+};<br>
+<br>
+struct B2 { // expected-note 2{{candidate}}<br>
+  B2(int); // expected-note {{candidate}}<br>
+};<br>
+<br>
+struct D1 : B1, B2 { // expected-note 2{{candidate}}<br>
+  using B1::B1; // expected-note 3{{inherited here}}<br>
+  using B2::B2; // expected-note 3{{inherited here}}<br>
+};<br>
+D1 d1(0); // expected-error {{ambiguous}}<br>
+<br>
+struct D2 : B1, B2 {<br>
+  using B1::B1;<br>
+  using B2::B2;<br>
+  D2(int);<br>
+};<br>
+D2 d2(0); // ok<br>
+<br>
+<br>
+// The emergent behavior of implicit special members is a bit odd when<br>
+// inheriting from multiple base classes.<br>
+namespace default_ctor {<br>
+  struct C;<br>
+  struct D;<br>
+<br>
+  struct A { // expected-note 4{{candidate}}<br>
+    A(); // expected-note {{candidate}}<br>
+<br>
+    A(C &&); // expected-note {{candidate}}<br>
+    C &operator=(C&&); // expected-note {{candidate}}<br>
+<br>
+    A(D &&); // expected-note {{candidate}}<br>
+    D &operator=(D&&); // expected-note {{candidate}}<br>
+  };<br>
+<br>
+  struct B { // expected-note 4{{candidate}}<br>
+    B(); // expected-note {{candidate}}<br>
+<br>
+    B(C &&); // expected-note {{candidate}}<br>
+    C &operator=(C&&); // expected-note {{candidate}}<br>
+<br>
+    B(D &&); // expected-note {{candidate}}<br>
+    D &operator=(D&&); // expected-note {{candidate}}<br>
+  };<br>
+<br>
+  struct C : A, B {<br>
+    using A::A;<br>
+    using A::operator=;<br>
+    using B::B;<br>
+    using B::operator=;<br>
+  };<br>
+  struct D : A, B {<br>
+    using A::A; // expected-note 5{{inherited here}}<br>
+    using A::operator=;<br>
+    using B::B; // expected-note 5{{inherited here}}<br>
+    using B::operator=;<br>
+<br>
+    D(int);<br>
+    D(const D&); // expected-note {{candidate}}<br>
+    D &operator=(const D&); // expected-note {{candidate}}<br>
+  };<br>
+<br>
+  C c;<br>
+  void f(C c) {<br>
+    C c2(static_cast<C&&>(c));<br>
+    c = static_cast<C&&>(c);<br>
+  }<br>
+<br>
+  // D does not declare D(), D(D&&), nor operator=(D&&), so the base class<br>
+  // versions are inherited.<br>
+  D d; // expected-error {{ambiguous}}<br>
+  void f(D d) {<br>
+    D d2(static_cast<D&&>(d)); // expected-error {{ambiguous}}<br>
+    d = static_cast<D&&>(d); // expected-error {{ambiguous}}<br>
+  }<br>
+}<br>
<br>
Added: cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p18.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p18.cpp?rev=274049&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>dcl.dcl/basic.namespace/<wbr>namespace.udecl/p18.cpp?rev=<wbr>274049&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p18.cpp (added)<br>
+++ cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p18.cpp Tue Jun 28 14:03:57 2016<br>
@@ -0,0 +1,77 @@<br>
+// RUN: %clang_cc1 -std=c++11 -verify %s<br>
+<br>
+struct Public {} public_;<br>
+struct Protected {} protected_;<br>
+struct Private {} private_;<br>
+<br>
+class A {<br>
+public:<br>
+  A(Public);<br>
+  void f(Public);<br>
+<br>
+protected:<br>
+  A(Protected); // expected-note {{protected here}}<br>
+  void f(Protected);<br>
+<br>
+private:<br>
+  A(Private); // expected-note 4{{private here}}<br>
+  void f(Private); // expected-note {{private here}}<br>
+<br>
+  friend void Friend();<br>
+};<br>
+<br>
+class B : private A {<br>
+  using A::A; // ok<br>
+  using A::f; // expected-error {{private member}}<br>
+<br>
+  void f() {<br>
+    B a(public_);<br>
+    B b(protected_);<br>
+    B c(private_); // expected-error {{private}}<br>
+  }<br>
+<br>
+  B(Public p, int) : B(p) {}<br>
+  B(Protected p, int) : B(p) {}<br>
+  B(Private p, int) : B(p) {} // expected-error {{private}}<br>
+};<br>
+<br>
+class C : public B {<br>
+  C(Public p) : B(p) {}<br>
+  // There is no access check on the conversion from derived to base here;<br>
+  // protected constructors of A act like protected constructors of B.<br>
+  C(Protected p) : B(p) {}<br>
+  C(Private p) : B(p) {} // expected-error {{private}}<br>
+};<br>
+<br>
+void Friend() {<br>
+  // There is no access check on the conversion from derived to base here.<br>
+  B a(public_);<br>
+  B b(protected_);<br>
+  B c(private_);<br>
+}<br>
+<br>
+void NonFriend() {<br>
+  B a(public_);<br>
+  B b(protected_); // expected-error {{protected}}<br>
+  B c(private_); // expected-error {{private}}<br>
+}<br>
+<br>
+namespace ProtectedAccessFromMember {<br>
+namespace a {<br>
+  struct ES {<br>
+  private:<br>
+    ES(const ES &) = delete;<br>
+  protected:<br>
+    ES(const char *);<br>
+  };<br>
+}<br>
+namespace b {<br>
+  struct DES : a::ES {<br>
+    DES *f();<br>
+  private:<br>
+    using a::ES::ES;<br>
+  };<br>
+}<br>
+b::DES *b::DES::f() { return new b::DES("foo"); }<br>
+<br>
+}<br>
<br>
Modified: cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p4.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>dcl.dcl/basic.namespace/<wbr>namespace.udecl/p4.cpp?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p4.cpp (original)<br>
+++ cfe/trunk/test/CXX/dcl.dcl/<wbr>basic.namespace/namespace.<wbr>udecl/p4.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1,4 +1,5 @@<br>
 // RUN: %clang_cc1 -fsyntax-only -verify %s<br>
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s<br>
<br>
 // C++03 [namespace.udecl]p4:<br>
 //   A using-declaration used as a member-declaration shall refer to a<br>
@@ -206,8 +207,33 @@ namespace test4 {<br>
     using Unrelated::foo; // expected-error {{not a base class}}<br>
     using C::foo; // legal in C++03<br>
     using Subclass::foo; // legal in C++03<br>
+#if __cplusplus >= 201103L<br>
+    // expected-error@-3 {{refers to its own class}}<br>
+    // expected-error@-3 {{refers into 'Subclass::', which is not a base class}}<br>
+#endif<br>
<br>
-    int bar(); //expected-note {{target of using declaration}}<br>
+    int bar();<br>
+#if __cplusplus < 201103L<br>
+    // expected-note@-2 {{target of using declaration}}<br>
+#endif<br>
     using C::bar; // expected-error {{refers to its own class}}<br>
   };<br>
 }<br>
+<br>
+namespace test5 {<br>
+  struct B;<br>
+  struct A {<br>
+    A(const B&);<br>
+    B &operator=(const B&);<br>
+  };<br>
+  struct B : A {<br>
+#if __cplusplus >= 201103L<br>
+    using A::A;<br>
+#endif<br>
+    using A::operator=;<br>
+  };<br>
+  void test(B b) {<br>
+    B b2(b);<br>
+    b2 = b;<br>
+  }<br>
+}<br>
<br>
Modified: cfe/trunk/test/CXX/drs/dr15xx.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr15xx.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>drs/dr15xx.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/drs/dr15xx.<wbr>cpp (original)<br>
+++ cfe/trunk/test/CXX/drs/dr15xx.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -22,6 +22,31 @@ namespace dr1560 { // dr1560: 3.5<br>
   const X &x = true ? get() : throw 0;<br>
 }<br>
<br>
+namespace dr1573 { // dr1573: 3.9<br>
+#if __cplusplus >= 201103L<br>
+  // ellipsis is inherited (p0136r1 supersedes this part).<br>
+  struct A { A(); A(int, char, ...); };<br>
+  struct B : A { using A::A; };<br>
+  B b(1, 'x', 4.0, "hello"); // ok<br>
+<br>
+  // inherited constructor is effectively constexpr if the user-written constructor would be<br>
+  struct C { C(); constexpr C(int) {} };<br>
+  struct D : C { using C::C; };<br>
+  constexpr D d = D(0); // ok<br>
+  struct E : C { using C::C; A a; }; // expected-note {{non-literal type}}<br>
+  constexpr E e = E(0); // expected-error {{non-literal type}}<br>
+  // FIXME: This diagnostic is pretty bad; we should explain that the problem<br>
+  // is that F::c would be initialized by a non-constexpr constructor.<br>
+  struct F : C { using C::C; C c; }; // expected-note {{here}}<br>
+  constexpr F f = F(0); // expected-error {{constant expression}} expected-note {{constructor inherited from base class 'C'}}<br>
+<br>
+  // inherited constructor is effectively deleted if the user-written constructor would be<br>
+  struct G { G(int); }; // expected-note {{declared here}}<br>
+  struct H : G { using G::G; G g; }; // expected-error {{cannot use constructor inherited from base class 'G'; member 'g' of 'dr1573::H' does not have a default constructor}} expected-note {{declared here}}<br>
+  H h(0); // expected-note {{first required here}}<br>
+#endif<br>
+}<br>
+<br>
 #if __cplusplus >= 201103L<br>
 namespace std {<br>
   typedef decltype(sizeof(int)) size_t;<br>
<br>
Modified: cfe/trunk/test/CXX/drs/dr16xx.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr16xx.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>drs/dr16xx.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/drs/dr16xx.<wbr>cpp (original)<br>
+++ cfe/trunk/test/CXX/drs/dr16xx.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -18,8 +18,8 @@ namespace dr1684 { // dr1684: 3.6<br>
 #endif<br>
 }<br>
<br>
+namespace dr1631 {  // dr1631: 3.7<br>
 #if __cplusplus >= 201103L<br>
-namespace dr1631 {  // dr1631: 3.7 c++11<br>
   // Incorrect overload resolution for single-element initializer-list<br>
<br>
   struct A { int a[1]; };<br>
@@ -41,5 +41,22 @@ namespace dr1631 {  // dr1631: 3.7 c++11<br>
       f({0}, {{1}});        // expected-error{{call to 'f' is ambiguous}}<br>
     }<br>
   }<br>
-} // dr1631<br>
 #endif<br>
+}<br>
+<br>
+namespace dr1645 { // dr1645: 3.9<br>
+#if __cplusplus >= 201103L<br>
+  struct A { // expected-note 2{{candidate}}<br>
+    constexpr A(int, float = 0); // expected-note 2{{candidate}}<br>
+    explicit A(int, int = 0); // expected-note 2{{candidate}}<br>
+    A(int, int, int = 0) = delete; // expected-note {{candidate}}<br>
+  };<br>
+<br>
+  struct B : A { // expected-note 2{{candidate}}<br>
+    using A::A; // expected-note 7{{inherited here}}<br>
+  };<br>
+<br>
+  constexpr B a(0); // expected-error {{ambiguous}}<br>
+  constexpr B b(0, 0); // expected-error {{ambiguous}}<br>
+#endif<br>
+}<br>
<br>
Modified: cfe/trunk/test/CXX/drs/dr17xx.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr17xx.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>drs/dr17xx.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/drs/dr17xx.<wbr>cpp (original)<br>
+++ cfe/trunk/test/CXX/drs/dr17xx.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -3,19 +3,63 @@<br>
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors<br>
 // RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors<br>
<br>
+#if __cplusplus < 201103L<br>
 // expected-no-diagnostics<br>
+#endif<br>
<br>
+namespace dr1715 { // dr1715: 3.9<br>
+#if __cplusplus >= 201103L<br>
+  struct B {<br>
+    template<class T> B(T, typename T::Q);<br>
+  };<br>
+<br>
+  class S {<br>
+    using Q = int;<br>
+    template<class T> friend B::B(T, typename T::Q);<br>
+  };<br>
+<br>
+  struct D : B {<br>
+    using B::B;<br>
+  };<br>
+  struct E : B { // expected-note 2{{candidate}}<br>
+    template<class T> E(T t, typename T::Q q) : B(t, q) {} // expected-note {{'Q' is a private member}}<br>
+  };<br>
+<br>
+  B b(S(), 1);<br>
+  D d(S(), 2);<br>
+  E e(S(), 3); // expected-error {{no match}}<br>
+#endif<br>
+}<br>
+<br>
+namespace dr1736 { // dr1736: 3.9<br>
+#if __cplusplus >= 201103L<br>
+struct S {<br>
+  template <class T> S(T t) {<br>
+    struct L : S {<br>
+      using S::S;<br>
+    };<br>
+    typename T::type value; // expected-error {{no member}}<br>
+    L l(value); // expected-note {{instantiation of}}<br>
+  }<br>
+};<br>
+struct Q { typedef int type; } q;<br>
+S s(q); // expected-note {{instantiation of}}<br>
+#endif<br>
+}<br>
+<br>
+namespace dr1756 { // dr1756: 3.7<br>
 #if __cplusplus >= 201103L<br>
-namespace dr1756 {  // dr1756: 3.7 c++11<br>
   // Direct-list-initialization of a non-class object<br>
<br>
   int a{0};<br>
<br>
   struct X { operator int(); } x;<br>
   int b{x};<br>
-} // dr1756<br>
+#endif<br>
+}<br>
<br>
-namespace dr1758 {  // dr1758: 3.7 c++11<br>
+namespace dr1758 { // dr1758: 3.7<br>
+#if __cplusplus >= 201103L<br>
   // Explicit conversion in copy/move list initialization<br>
<br>
   struct X { X(); };<br>
@@ -30,5 +74,5 @@ namespace dr1758 {  // dr1758: 3.7 c++11<br>
     operator A() { return A(); }<br>
   } b;<br>
   A a{b};<br>
-} // dr1758<br>
 #endif<br>
+}<br>
<br>
Modified: cfe/trunk/test/CXX/drs/dr19xx.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr19xx.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>drs/dr19xx.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/drs/dr19xx.<wbr>cpp (original)<br>
+++ cfe/trunk/test/CXX/drs/dr19xx.<wbr>cpp Tue Jun 28 14:03:57 2016<br>
@@ -39,6 +39,31 @@ namespace dr1902 { // dr1902: 3.7<br>
 #endif<br>
 }<br>
<br>
+namespace dr1903 {<br>
+  namespace A {<br>
+    struct a {};<br>
+    int a;<br>
+    namespace B {<br>
+      int b;<br>
+    }<br>
+    using namespace B;<br>
+    namespace {<br>
+      int c;<br>
+    }<br>
+    namespace D {<br>
+      int d;<br>
+    }<br>
+    using D::d;<br>
+  }<br>
+  namespace X {<br>
+    using A::a;<br>
+    using A::b;<br>
+    using A::c;<br>
+    using A::d;<br>
+    struct a *p;<br>
+  }<br>
+}<br>
+<br>
 namespace dr1909 { // dr1909: yes<br>
   struct A {<br>
     template<typename T> struct A {}; // expected-error {{member 'A' has the same name as its class}}<br>
@@ -54,22 +79,52 @@ namespace dr1909 { // dr1909: yes<br>
   };<br>
 }<br>
<br>
-#if __cplusplus >= 201103L<br>
 namespace dr1940 { // dr1940: yes<br>
+#if __cplusplus >= 201103L<br>
 static union {<br>
   static_assert(true, "");  // ok<br>
   static_assert(false, ""); // expected-error {{static_assert failed}}<br>
 };<br>
-}<br>
 #endif<br>
+}<br>
<br>
+namespace dr1941 { // dr1941: 3.9<br>
 #if __cplusplus >= 201402L<br>
+template<typename X><br>
+struct base {<br>
+  template<typename T><br>
+  base(T a, T b, decltype(void(*T()), 0) = 0) {<br>
+    while (a != b) (void)*a++;<br>
+  }<br>
+<br>
+  template<typename T><br>
+  base(T a, X x, decltype(void(T(0) * 1), 0) = 0) {<br>
+    for (T n = 0; n != a; ++n) (void)X(x);<br>
+  }<br>
+};<br>
+<br>
+struct derived : base<int> {<br>
+  using base::base;<br>
+};<br>
+<br>
+struct iter {<br>
+  iter operator++(int);<br>
+  int operator*();<br>
+  friend bool operator!=(iter, iter);<br>
+} it, end;<br>
+<br>
+derived d1(it, end);<br>
+derived d2(42, 9);<br>
+#endif<br>
+}<br>
+<br>
 namespace dr1947 { // dr1947: yes<br>
+#if __cplusplus >= 201402L<br>
 unsigned o = 0'01;  // ok<br>
 unsigned b = 0b'01; // expected-error {{invalid digit 'b' in octal constant}}<br>
 unsigned x = 0x'01; // expected-error {{invalid suffix 'x'01' on integer constant}}<br>
-}<br>
 #endif<br>
+}<br>
<br>
 #if __cplusplus >= 201103L<br>
 // dr1948: yes<br>
@@ -77,10 +132,58 @@ unsigned x = 0x'01; // expected-error {{<br>
 void *operator new(__SIZE_TYPE__) noexcept { return nullptr; } // expected-error{{exception specification in declaration does not match previous declaration}}<br>
 #endif<br>
<br>
+namespace dr1959 { // dr1959: 3.9<br>
 #if __cplusplus >= 201103L<br>
+  struct b;<br>
+  struct c;<br>
+  struct a {<br>
+    a() = default;<br>
+    a(const a &) = delete; // expected-note 2{{deleted}}<br>
+    a(const b &) = delete; // not inherited<br>
+    a(c &&) = delete; // expected-note {{deleted}}<br>
+    template<typename T> a(T) = delete;<br>
+  };<br>
+<br>
+  struct b : a { // expected-note {{copy constructor of 'b' is implicitly deleted because base class 'dr1959::a' has a deleted copy constructor}}<br>
+    using a::a;<br>
+  };<br>
+<br>
+  a x;<br>
+  b y = x; // expected-error {{deleted}}<br>
+  b z = z; // expected-error {{deleted}}<br>
+<br>
+  // FIXME: It's not really clear that this matches the intent, but it's<br>
+  // consistent with the behavior for assignment operators.<br>
+  struct c : a {<br>
+    using a::a;<br>
+    c(const c &);<br>
+  };<br>
+  c q(static_cast<c&&>(q)); // expected-error {{call to deleted}}<br>
+#endif<br>
+}<br>
+<br>
 namespace dr1968 { // dr1968: yes<br>
-static_assert(&typeid(int) == &typeid(int), ""); // expected-error{{not an integral constant expression}}<br>
+#if __cplusplus >= 201103L<br>
+  static_assert(&typeid(int) == &typeid(int), ""); // expected-error{{not an integral constant expression}}<br>
+#endif<br>
 }<br>
+<br>
+namespace dr1991 { // dr1991: 3.9<br>
+#if __cplusplus >= 201103L<br>
+  struct A {<br>
+    A(int, int) = delete;<br>
+  };<br>
+<br>
+  struct B : A {<br>
+    using A::A;<br>
+    B(int, int, int = 0);<br>
+  };<br>
+<br>
+  // FIXME: As a resolution to an open DR against P0136R1, we treat derived<br>
+  // class constructors as better than base class constructors in the presence<br>
+  // of ambiguity.<br>
+  B b(0, 0); // ok, calls B constructor<br>
 #endif<br>
+}<br>
<br>
 // dr1994: dup 529<br>
<br>
Modified: cfe/trunk/test/CXX/except/<wbr>except.spec/p14.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/except/except.spec/p14.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>except/except.spec/p14.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/except/<wbr>except.spec/p14.cpp (original)<br>
+++ cfe/trunk/test/CXX/except/<wbr>except.spec/p14.cpp Tue Jun 28 14:03:57 2016<br>
@@ -124,14 +124,20 @@ namespace InhCtor {<br>
   template<typename T> struct Throw {<br>
     Throw() throw(T);<br>
   };<br>
-  struct Derived : Base, Throw<X<3>> {<br>
+  struct Derived1 : Base, X<5> {<br>
+    using Base::Base;<br>
+    int n;<br>
+  };<br>
+  struct Derived2 : Base, Throw<X<3>> {<br>
     using Base::Base;<br>
-    Throw<X<4>> x;<br>
   };<br>
-  struct Test {<br>
-    friend Derived::Derived(X<0>) throw(X<3>, X<4>);<br>
-    friend Derived::Derived(X<1>) noexcept(false);<br>
-    friend Derived::Derived(X<2>) throw(X<2>, X<3>, X<4>);<br>
+  struct Derived3 : Base {<br>
+    using Base::Base;<br>
+    Throw<X<4>> x;<br>
   };<br>
-  static_assert(!noexcept(<wbr>Derived{X<5>{}}), "");<br>
+  static_assert(noexcept(<wbr>Derived1(X<0>())), "");<br>
+  static_assert(!noexcept(<wbr>Derived1(X<1>())), "");<br>
+  static_assert(!noexcept(<wbr>Derived1(X<2>())), "");<br>
+  static_assert(!noexcept(<wbr>Derived2(X<0>())), "");<br>
+  static_assert(!noexcept(<wbr>Derived3(X<0>())), "");<br>
 }<br>
<br>
Modified: cfe/trunk/test/CXX/special/<wbr>class.inhctor/p1.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/p1.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>special/class.inhctor/p1.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/special/<wbr>class.inhctor/p1.cpp (original)<br>
+++ cfe/trunk/test/CXX/special/<wbr>class.inhctor/p1.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1,53 +1,55 @@<br>
 // RUN: %clang_cc1 -std=c++11 -verify %s<br>
-// Per a core issue (no number yet), an ellipsis is always dropped.<br>
-struct A {<br>
-  A(...); // expected-note {{here}}<br>
-  A(int = 0, int = 0, int = 0, int = 0, ...); // expected-note 9{{here}} expected-note 2{{constructor cannot be inherited}}<br>
-  A(int = 0, int = 0, ...); // expected-note {{here}}<br>
+//<br>
+// Note: [class.inhctor] was removed by P0136R1. This tests the new behavior<br>
+// for the wording that used to be there.<br>
+<br>
+struct A { // expected-note 8{{candidate is the implicit}}<br>
+  A(...); // expected-note 4{{candidate constructor}} expected-note 4{{candidate inherited constructor}}<br>
+  A(int = 0, int = 0, int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}}<br>
+  A(int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}}<br>
<br>
-  template<typename T> A(T, int = 0, ...); // expected-note 5{{here}}<br>
+  template<typename T> A(T, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}}<br>
<br>
-  template<typename T, int N> A(const T (&)[N]); // expected-note 2{{here}} expected-note {{constructor cannot be inherited}}<br>
-  template<typename T, int N> A(const T (&)[N], int = 0); // expected-note 2{{here}}<br>
+  template<typename T, int N> A(const T (&)[N]); // expected-note {{candidate constructor}} expected-note {{candidate inherited constructor}}<br>
+  template<typename T, int N> A(const T (&)[N], int = 0); // expected-note {{candidate constructor}} expected-note {{candidate inherited constructor}}<br>
 };<br>
<br>
-struct B : A { // expected-note 6{{candidate}}<br>
-  using A::A; // expected-warning 4{{inheriting constructor does not inherit ellipsis}} expected-note 16{{candidate}} expected-note 3{{deleted constructor was inherited here}}<br>
+struct B : A { // expected-note 4{{candidate is the implicit}}<br>
+  using A::A; // expected-note 19{{inherited here}}<br>
+  B(void*);<br>
 };<br>
<br>
 struct C {} c;<br>
<br>
-B b0{};<br>
-// expected-error@-1 {{call to implicitly-deleted default constructor of 'B'}}<br>
-// expected-note@-8 {{default constructor of 'B' is implicitly deleted because base class 'A' has multiple default constructors}}<br>
+A a0{}; // expected-error {{ambiguous}}<br>
+B b0{}; // expected-error {{ambiguous}}<br>
<br>
-B b1{1};<br>
-// expected-error@-1 {{call to deleted constructor of 'B'}}<br>
+A a1{1}; // expected-error {{ambiguous}}<br>
+B b1{1}; // expected-error {{ambiguous}}<br>
<br>
-B b2{1,2};<br>
-// expected-error@-1 {{call to deleted constructor of 'B'}}<br>
+A a2{1,2}; // expected-error {{ambiguous}}<br>
+B b2{1,2}; // expected-error {{ambiguous}}<br>
<br>
-B b3{1,2,3};<br>
-// ok<br>
+A a3{1,2,3}; // ok<br>
+B b3{1,2,3}; // ok<br>
<br>
-B b4{1,2,3,4};<br>
-// ok<br>
+A a4{1,2,3,4}; // ok<br>
+B b4{1,2,3,4}; // ok<br>
<br>
-B b5{1,2,3,4,5};<br>
-// expected-error@-1 {{no matching constructor for initialization of 'B'}}<br>
+A a5{1,2,3,4,5}; // ok<br>
+B b5{1,2,3,4,5}; // ok<br>
<br>
-B b6{c};<br>
-// ok<br>
+A a6{c}; // ok<br>
+B b6{c}; // ok<br>
<br>
-B b7{c,0};<br>
-// ok<br>
+A a7{c,0}; // ok<br>
+B b7{c,0}; // ok<br>
<br>
-B b8{c,0,1};<br>
-// expected-error@-1 {{no matching constructor}}<br>
+A a8{c,0,1}; // ok<br>
+B b8{c,0,1}; // ok<br>
<br>
-B b9{"foo"};<br>
-// FIXME: explain why the inheriting constructor was deleted<br>
-// expected-error@-2 {{call to deleted constructor of 'B'}}<br>
+A a9{"foo"}; // expected-error {{ambiguous}}<br>
+B b9{"foo"}; // expected-error {{ambiguous}}<br>
<br>
 namespace PR15755 {<br>
   struct X {<br>
<br>
Modified: cfe/trunk/test/CXX/special/<wbr>class.inhctor/p2.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/p2.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>special/class.inhctor/p2.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/special/<wbr>class.inhctor/p2.cpp (original)<br>
+++ cfe/trunk/test/CXX/special/<wbr>class.inhctor/p2.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1,4 +1,7 @@<br>
 // RUN: %clang_cc1 -std=c++11 -verify %s<br>
+//<br>
+// Note: [class.inhctor] was removed by P0136R1. This tests the new behavior<br>
+// for the wording that used to be there.<br>
<br>
 template<int> struct X {};<br>
<br>
@@ -8,10 +11,10 @@ template<int> struct X {};<br>
 //   - absence or presence of explicit<br>
 //   - absence or presence of constexpr<br>
 struct A {<br>
-  A(X<0>) {} // expected-note 2{{here}}<br>
+  A(X<0>) {} // expected-note 4{{here}}<br>
   constexpr A(X<1>) {}<br>
-  explicit A(X<2>) {} // expected-note 3{{here}}<br>
-  explicit constexpr A(X<3>) {} // expected-note 2{{here}}<br>
+  explicit A(X<2>) {} // expected-note 6{{here}}<br>
+  explicit constexpr A(X<3>) {} // expected-note 4{{here}}<br>
 };<br>
<br>
 A a0 { X<0>{} };<br>
@@ -36,7 +39,7 @@ constexpr A a3ic = { X<3>{} }; // expect<br>
<br>
<br>
 struct B : A {<br>
-  using A::A; // expected-note 7{{here}}<br>
+  using A::A;<br>
 };<br>
<br>
 B b0 { X<0>{} };<br>
@@ -62,14 +65,19 @@ constexpr B b3ic = { X<3>{} }; // expect<br>
<br>
 // 'constexpr' is OK even if the constructor doesn't obey the constraints.<br>
 struct NonLiteral { NonLiteral(); };<br>
-struct NonConstexpr { NonConstexpr(); constexpr NonConstexpr(int); }; // expected-note {{here}}<br>
+struct NonConstexpr { NonConstexpr(); constexpr NonConstexpr(int); };<br>
 struct Constexpr { constexpr Constexpr(int) {} };<br>
<br>
 struct BothNonLiteral : NonLiteral, Constexpr { using Constexpr::Constexpr; }; // expected-note {{base class 'NonLiteral' of non-literal type}}<br>
 constexpr BothNonLiteral bothNL{42}; // expected-error {{constexpr variable cannot have non-literal type 'const BothNonLiteral'}}<br>
<br>
-struct BothNonConstexpr : NonConstexpr, Constexpr { using Constexpr::Constexpr; }; // expected-note {{non-constexpr constructor 'NonConstexpr}}<br>
-constexpr BothNonConstexpr bothNC{42}; // expected-error {{must be initialized by a constant expression}} expected-note {{in call to 'BothNonConstexpr(42)'}}<br>
+// FIXME: This diagnostic is not very good. We should explain that the problem is that base class NonConstexpr cannot be initialized.<br>
+struct BothNonConstexpr<br>
+    : NonConstexpr,<br>
+      Constexpr {<br>
+  using Constexpr::Constexpr; // expected-note {{here}}<br>
+};<br>
+constexpr BothNonConstexpr bothNC{42}; // expected-error {{must be initialized by a constant expression}} expected-note {{inherited from base class 'Constexpr'}}<br>
<br>
<br>
 struct ConstexprEval {<br>
@@ -87,25 +95,25 @@ static_assert(ce.k == 'a', "");<br>
 static_assert(ce.k2 == 'x', "");<br>
<br>
<br>
-struct TemplateCtors {<br>
-  constexpr TemplateCtors() {}<br>
-  template<template<int> class T> TemplateCtors(X<0>, T<0>);<br>
-  template<int N> TemplateCtors(X<1>, X<N>);<br>
-  template<typename T> TemplateCtors(X<2>, T);<br>
+struct TemplateCtors { // expected-note 2{{candidate constructor (the implicit}}<br>
+  constexpr TemplateCtors() {} // expected-note {{candidate inherited constructor}}<br>
+  template<template<int> class T> TemplateCtors(X<0>, T<0>); // expected-note {{here}} expected-note {{candidate inherited constructor}}<br>
+  template<int N> TemplateCtors(X<1>, X<N>); // expected-note {{here}} expected-note {{candidate inherited constructor}}<br>
+  template<typename T> TemplateCtors(X<2>, T); // expected-note {{here}} expected-note {{candidate inherited constructor}}<br>
<br>
-  template<typename T = int> TemplateCtors(int, int = 0, int = 0); // expected-note {{inherited from here}}<br>
+  template<typename T = int> TemplateCtors(int, int = 0, int = 0);<br>
 };<br>
<br>
-struct UsingTemplateCtors : TemplateCtors {  // expected-note 2{{candidate is the implicit}}<br>
-  using TemplateCtors::TemplateCtors; // expected-note 4{{here}} expected-note {{candidate}}<br>
+struct UsingTemplateCtors : TemplateCtors { // expected-note 2{{candidate constructor (the implicit}}<br>
+  using TemplateCtors::TemplateCtors; // expected-note 6{{inherited here}}<br>
<br>
-  constexpr UsingTemplateCtors(X<0>, X<0>) {}<br>
-  constexpr UsingTemplateCtors(X<1>, X<1>) {}<br>
-  constexpr UsingTemplateCtors(X<2>, X<2>) {}<br>
+  constexpr UsingTemplateCtors(X<0>, X<0>) {} // expected-note {{not viable}}<br>
+  constexpr UsingTemplateCtors(X<1>, X<1>) {} // expected-note {{not viable}}<br>
+  constexpr UsingTemplateCtors(X<2>, X<2>) {} // expected-note {{not viable}}<br>
<br>
-  template<int = 0> constexpr UsingTemplateCtors(int) {} // expected-note {{candidate}}<br>
-  template<typename T = void> constexpr UsingTemplateCtors(int, int) {}<br>
-  template<typename T, typename U> constexpr UsingTemplateCtors(int, int, int) {}<br>
+  template<int = 0> constexpr UsingTemplateCtors(int) {} // expected-note {{not viable}}<br>
+  template<typename T = void> constexpr UsingTemplateCtors(int, int) {} // expected-note {{not viable}}<br>
+  template<typename T, typename U> constexpr UsingTemplateCtors(int, int, int) {} // expected-note {{couldn't infer}}<br>
 };<br>
<br>
 template<int> struct Y {};<br>
@@ -116,6 +124,10 @@ constexpr UsingTemplateCtors uct4{ X<1>{<br>
 constexpr UsingTemplateCtors uct5{ X<2>{}, 0 }; // expected-error {{must be initialized by a constant expression}} expected-note {{non-constexpr}}<br>
 constexpr UsingTemplateCtors uct6{ X<2>{}, X<2>{} };<br>
<br>
-constexpr UsingTemplateCtors utc7{ 0 }; // expected-error {{ambiguous}}<br>
+constexpr UsingTemplateCtors utc7{ 0 }; // ok<br>
 constexpr UsingTemplateCtors utc8{ 0, 0 }; // ok<br>
-constexpr UsingTemplateCtors utc9{ 0, 0, 0 }; // expected-error {{must be initialized by a constant expression}} expected-note {{non-constexpr}}<br>
+// FIXME: The standard says that UsingTemplateCtors' (int, int, int) constructor<br>
+// hides the one from TemplateCtors, even though the template parameter lists<br>
+// don't match. It's not clear that that's *really* the intent, and it's not<br>
+// what other compilers do.<br>
+constexpr UsingTemplateCtors utc9{ 0, 0, 0 }; // expected-error {{no matching constructor}}<br>
<br>
Modified: cfe/trunk/test/CXX/special/<wbr>class.inhctor/p3.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/p3.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>special/class.inhctor/p3.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/special/<wbr>class.inhctor/p3.cpp (original)<br>
+++ cfe/trunk/test/CXX/special/<wbr>class.inhctor/p3.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1,8 +1,11 @@<br>
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s<br>
+//<br>
+// Note: [class.inhctor] was removed by P0136R1. This tests the new behavior<br>
+// for the wording that used to be there.<br>
<br>
 struct B1 {<br>
-  B1(int);<br>
-  B1(int, int);<br>
+  B1(int); // expected-note 3{{target of using}}<br>
+  B1(int, int); // expected-note 3{{target of using}}<br>
 };<br>
 struct D1 : B1 {<br>
   using B1::B1;<br>
@@ -11,48 +14,56 @@ D1 d1a(1), d1b(1, 1);<br>
<br>
 D1 fd1() { return 1; }<br>
<br>
-struct B2 {<br>
+struct B2 { // expected-note 2{{candidate}}<br>
   explicit B2(int, int = 0, int = 0);<br>
 };<br>
-struct D2 : B2 { // expected-note 2 {{candidate constructor}}<br>
-  using B2::B2;<br>
+struct D2 : B2 { // expected-note 2{{candidate constructor}}<br>
+  using B2::B2; // expected-note 2{{inherited here}}<br>
 };<br>
 D2 d2a(1), d2b(1, 1), d2c(1, 1, 1);<br>
<br>
 D2 fd2() { return 1; } // expected-error {{no viable conversion}}<br>
<br>
-struct B3 {<br>
-  B3(void*); // expected-note {{inherited from here}}<br>
+struct B3 { // expected-note 2{{candidate}}<br>
+  B3(void*); // expected-note {{candidate}}<br>
 };<br>
-struct D3 : B3 { // expected-note 2 {{candidate constructor}}<br>
-  using B3::B3; // expected-note {{candidate constructor (inherited)}}<br>
+struct D3 : B3 { // expected-note 2{{candidate constructor}}<br>
+  using B3::B3; // expected-note 3{{inherited here}}<br>
 };<br>
 D3 fd3() { return 1; } // expected-error {{no viable conversion}}<br>
<br>
 template<typename T> struct T1 : B1 {<br>
-  using B1::B1;<br>
+  using B1::B1; // expected-note 2{{using declaration}}<br>
 };<br>
 template<typename T> struct T2 : T1<T> {<br>
-  using T1<int>::T1;<br>
+  using T1<int>::T1; // expected-note 2{{using declaration}}<br>
 };<br>
 template<typename T> struct T3 : T1<int> {<br>
-  using T1<T>::T1;<br>
+  using T1<T>::T1; // expected-note 2{{using declaration}}<br>
 };<br>
 struct U {<br>
-  friend T1<int>::T1(int);<br>
-  friend T1<int>::T1(int, int);<br>
-  friend T2<int>::T2(int);<br>
-  friend T2<int>::T2(int, int);<br>
-  friend T3<int>::T3(int);<br>
-  friend T3<int>::T3(int, int);<br>
+  // [dcl.meaning]p1: "the member shall not merely hav ebeen introduced by a<br>
+  // using-declaration in the scope of the class [...] nominated by the<br>
+  // nested-name-specifier of the declarator-id"<br>
+  friend T1<int>::T1(int); // expected-error {{cannot befriend target of using declaration}}<br>
+  friend T1<int>::T1(int, int); // expected-error {{cannot befriend target of using declaration}}<br>
+  friend T2<int>::T2(int); // expected-error {{cannot befriend target of using declaration}}<br>
+  friend T2<int>::T2(int, int); // expected-error {{cannot befriend target of using declaration}}<br>
+  friend T3<int>::T3(int); // expected-error {{cannot befriend target of using declaration}}<br>
+  friend T3<int>::T3(int, int); // expected-error {{cannot befriend target of using declaration}}<br>
 };<br>
<br>
 struct B4 {<br>
-  template<typename T> explicit B4(T, int = 0);<br>
+  template<typename T> explicit B4(T, int = 0); // expected-note 2{{here}}<br>
 };<br>
 template<typename T> struct T4 : B4 {<br>
-  using B4::B4; // expected-note {{here}}<br>
+  using B4::B4;<br>
   template<typename U> T4(U);<br>
 };<br>
+template<typename T> struct U4 : T4<T> {<br>
+  using T4<T>::T4;<br>
+};<br>
 T4<void> t4a = {0};<br>
 T4<void> t4b = {0, 0}; // expected-error {{chosen constructor is explicit}}<br>
+U4<void> u4a = {0};<br>
+U4<void> u4b = {0, 0}; // expected-error {{chosen constructor is explicit}}<br>
<br>
Modified: cfe/trunk/test/CXX/special/<wbr>class.inhctor/p4.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/p4.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>special/class.inhctor/p4.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/special/<wbr>class.inhctor/p4.cpp (original)<br>
+++ cfe/trunk/test/CXX/special/<wbr>class.inhctor/p4.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1,4 +1,7 @@<br>
 // RUN: %clang_cc1 -std=c++11 -verify %s<br>
+//<br>
+// Note: [class.inhctor] was removed by P0136R1. This tests the new behavior<br>
+// for the wording that used to be there.<br>
<br>
 template<int> struct X {};<br>
<br>
@@ -8,20 +11,20 @@ struct A {<br>
 public:<br>
   A(X<0>) {}<br>
 protected:<br>
-  A(X<1>) {}<br>
+  A(X<1>) {} // expected-note 2{{declared protected here}}<br>
 private:<br>
-  A(X<2>) {} // expected-note {{declared private here}}<br>
+  A(X<2>) {} // expected-note 2{{declared private here}}<br>
   friend class FA;<br>
 };<br>
<br>
 struct B : A {<br>
-  using A::A; // expected-error {{private constructor}} expected-note {{implicitly declared protected here}}<br>
+  using A::A;<br>
   friend class FB;<br>
 };<br>
<br>
 B b0{X<0>{}};<br>
 B b1{X<1>{}}; // expected-error {{calling a protected constructor}}<br>
-B b2{X<2>{}}; // expected-note {{first required here}}<br>
+B b2{X<2>{}}; // expected-error {{calling a private constructor}}<br>
<br>
 struct C : B {<br>
   C(X<0> x) : B(x) {}<br>
@@ -34,7 +37,7 @@ struct FB {<br>
 };<br>
<br>
 struct FA : A {<br>
-  using A::A; // expected-note 2{{here}}<br>
+  using A::A;<br>
 };<br>
 FA fa0{X<0>{}};<br>
 FA fa1{X<1>{}}; // expected-error {{calling a protected constructor}}<br>
@@ -47,7 +50,7 @@ struct G {<br>
   template<typename T> G(T*) = delete; // expected-note {{'G<const char>' has been explicitly marked deleted here}}<br>
 };<br>
 struct H : G {<br>
-  using G::G; // expected-note 2{{deleted constructor was inherited here}}<br>
+  using G::G;<br>
 };<br>
 H h1(5); // expected-error {{call to deleted constructor of 'H'}}<br>
 H h2("foo"); // expected-error {{call to deleted constructor of 'H'}}<br>
@@ -57,15 +60,15 @@ H h2("foo"); // expected-error {{call to<br>
 // same signature.<br>
 namespace DRnnnn {<br>
   struct A {<br>
-    constexpr A(int, float = 0) {}<br>
-    explicit A(int, int = 0) {} // expected-note {{constructor cannot be inherited}}<br>
+    constexpr A(int, float = 0) {} // expected-note {{candidate}}<br>
+    explicit A(int, int = 0) {} // expected-note {{candidate}}<br>
<br>
-    A(int, int, int = 0) = delete;<br>
+    A(int, int, int = 0) = delete; // expected-note {{deleted}}<br>
   };<br>
   struct B : A {<br>
-    using A::A; // expected-note {{here}}<br>
+    using A::A; // expected-note 3{{inherited here}}<br>
   };<br>
<br>
   constexpr B b0(0, 0.0f); // ok, constexpr<br>
-  B b1(0, 1); // expected-error {{call to deleted constructor of 'DRnnnn::B'}}<br>
+  B b1(0, 1); // expected-error {{call to constructor of 'DRnnnn::B' is ambiguous}}<br>
 }<br>
<br>
Modified: cfe/trunk/test/CXX/special/<wbr>class.inhctor/p7.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/p7.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>special/class.inhctor/p7.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/special/<wbr>class.inhctor/p7.cpp (original)<br>
+++ cfe/trunk/test/CXX/special/<wbr>class.inhctor/p7.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1,47 +1,48 @@<br>
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s<br>
+//<br>
+// Note: [class.inhctor] was removed by P0136R1. This tests the new behavior<br>
+// for the wording that used to be there.<br>
<br>
-// Straight from the standard<br>
-struct B1 {<br>
-  B1(int); // expected-note {{previous constructor}} expected-note {{conflicting constructor}}<br>
-};<br>
-struct B2 {<br>
-  B2(int); // expected-note {{conflicting constructor}}<br>
-};<br>
-struct D1 : B1, B2 {<br>
-  using B1::B1; // expected-note {{inherited here}}<br>
-  using B2::B2; // expected-error {{already inherited constructor with the same signature}}<br>
+struct B1 { // expected-note 2{{candidate}}<br>
+  B1(int); // expected-note {{candidate}}<br>
+};<br>
+struct B2 { // expected-note 2{{candidate}}<br>
+  B2(int); // expected-note {{candidate}}<br>
+};<br>
+struct D1 : B1, B2 { // expected-note 2{{candidate}}<br>
+  using B1::B1; // expected-note 3{{inherited here}}<br>
+  using B2::B2; // expected-note 3{{inherited here}}<br>
 };<br>
 struct D2 : B1, B2 {<br>
   using B1::B1;<br>
   using B2::B2;<br>
   D2(int);<br>
 };<br>
+D1 d1(0); // expected-error {{ambiguous}}<br>
+D2 d2(0);<br>
<br>
 template<typename T> struct B3 {<br>
-  B3(T); // expected-note {{previous constructor}}<br>
+  B3(T);<br>
 };<br>
 template<typename T> struct B4 : B3<T>, B1 {<br>
   B4();<br>
-  using B3<T>::B3; // expected-note {{inherited here}}<br>
-  using B1::B1; // expected-error {{already inherited}}<br>
+  using B3<T>::B3;<br>
+  using B1::B1;<br>
 };<br>
 B4<char> b4c;<br>
-B4<int> b4i; // expected-note {{here}}<br>
+B4<int> b4i;<br>
<br>
 struct B5 {<br>
-  template<typename T> B5(T); // expected-note {{previous constructor}}<br>
+  template<typename T> B5(T);<br>
 };<br>
-struct B6 {<br>
-  template<typename T> B6(T); // expected-note {{conflicting constructor}}<br>
-};<br>
-struct B7 {<br>
-  template<typename T, int> B7(T);<br>
-};<br>
-struct D56 : B5, B6, B7 {<br>
-  using B5::B5; // expected-note {{inherited here}}<br>
-  using B6::B6; // expected-error {{already inherited}}<br>
+struct D6 : B5 {<br>
+  using B5::B5;<br>
+  template<typename T> D6(T);<br>
 };<br>
-struct D57 : B5, B6, B7 {<br>
+D6 d6(0);<br>
+struct D7 : B5 {<br>
   using B5::B5;<br>
-  using B7::B7; // ok, not the same signature<br>
+  template<typename T> D7(T, ...);<br>
 };<br>
+// DRxxx (no number yet): derived class ctor beats base class ctor.<br>
+D7 d7(0);<br>
<br>
Modified: cfe/trunk/test/CXX/special/<wbr>class.inhctor/p8.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/p8.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>special/class.inhctor/p8.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/special/<wbr>class.inhctor/p8.cpp (original)<br>
+++ cfe/trunk/test/CXX/special/<wbr>class.inhctor/p8.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1,4 +1,7 @@<br>
 // RUN: %clang_cc1 -std=c++11 -verify %s<br>
+//<br>
+// Note: [class.inhctor] was removed by P0136R1. This tests the new behavior<br>
+// for the wording that used to be there.<br>
<br>
 struct A {<br>
   constexpr A(const int&) : rval(false) {}<br>
@@ -13,8 +16,6 @@ constexpr int k = 0;<br>
 constexpr A a0{0};<br>
 constexpr A a1{k};<br>
 constexpr B b0{0};<br>
-// This performs static_cast<(const int&)&&>(k), so calls the A(const int&)<br>
-// constructor.<br>
 constexpr B b1{k};<br>
<br>
 static_assert(a0.rval && !a1.rval && b0.rval && !b1.rval, "");<br>
@@ -28,5 +29,4 @@ struct D : C {<br>
 };<br>
 static_assert(D(123).v == 123, "");<br>
<br>
-// FIXME: This diagnostic sucks.<br>
-template<typename T> constexpr D::D(T t) : C(t) {} // expected-error {{definition of implicitly declared function}}<br>
+template<typename T> constexpr D::D(T t) : C(t) {} // expected-error {{does not match any declaration in 'D'}}<br>
<br>
Added: cfe/trunk/test/CXX/special/<wbr>class.init/class.inhctor.init/<wbr>p1.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp?rev=274049&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>special/class.init/class.<wbr>inhctor.init/p1.cpp?rev=<wbr>274049&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/special/<wbr>class.init/class.inhctor.init/<wbr>p1.cpp (added)<br>
+++ cfe/trunk/test/CXX/special/<wbr>class.init/class.inhctor.init/<wbr>p1.cpp Tue Jun 28 14:03:57 2016<br>
@@ -0,0 +1,124 @@<br>
+// RUN: %clang_cc1 -std=c++11 -verify %s<br>
+<br>
+namespace std_example {<br>
+  struct B1 { // expected-note {{declared here}}<br>
+    B1(int, ...) {}<br>
+  };<br>
+<br>
+  struct B2 {<br>
+    B2(double) {}<br>
+  };<br>
+<br>
+  int get();<br>
+<br>
+  struct D1 : B1 { // expected-note {{no default constructor}}<br>
+    using B1::B1; // inherits B1(int, ...)<br>
+    int x;<br>
+    int y = get();<br>
+  };<br>
+<br>
+  void test() {<br>
+    D1 d(2, 3, 4); // OK: B1 is initialized by calling B1(2, 3, 4),<br>
+    // then d.x is default-initialized (no initialization is performed),<br>
+    // then d.y is initialized by calling get()<br>
+    D1 e; // expected-error {{implicitly-deleted}}<br>
+  }<br>
+<br>
+  struct D2 : B2 {<br>
+    using B2::B2; // expected-error {{cannot use constructor inherited from base class 'B2'; member 'b' of 'std_example::D2' does not have a default constructor}}<br>
+    B1 b; // expected-note {{member}}<br>
+  };<br>
+<br>
+  D2 f(1.0); // expected-note {{inherited constructor for 'D2' first required here}}<br>
+<br>
+  struct W {<br>
+    W(int);<br>
+  };<br>
+  struct X : virtual W {<br>
+    using W::W;<br>
+    X() = delete;<br>
+  };<br>
+  struct Y : X {<br>
+    using X::X;<br>
+  };<br>
+  struct Z : Y, virtual W {<br>
+    using Y::Y;<br>
+  };<br>
+  Z z(0); // OK: initialization of Y does not invoke default constructor of X<br>
+<br>
+  template <class T> struct Log : T {<br>
+    using T::T; // inherits all constructors from class T<br>
+    ~Log() { /* ... */ }<br>
+  };<br>
+}<br>
+<br>
+namespace vbase {<br>
+  struct V { // expected-note 2{{declared here}}<br>
+    V(int);<br>
+  };<br>
+<br>
+  struct A : virtual V {<br>
+    A() = delete; // expected-note 2{{deleted here}} expected-note {{deleted}}<br>
+    using V::V;<br>
+  };<br>
+  struct B : virtual V {<br>
+    B() = delete; // expected-note 2{{deleted here}}<br>
+    B(int, int);<br>
+    using V::V;<br>
+  };<br>
+  struct C : B { // expected-note {{deleted default constructor}}<br>
+    using B::B; // expected-error {{cannot use constructor inherited from base class 'B'; base class 'vbase::V' of 'vbase::C' does not have a default constructor}}<br>
+  };<br>
+  struct D : A, C { // expected-note {{deleted default constructor}}<br>
+    using A::A;<br>
+    using C::C; // expected-error {{cannot use constructor inherited from base class 'C'; base class 'vbase::V' of 'vbase::D' does not have a default constructor}} expected-error {{call to deleted constructor of 'vbase::A'}}<br>
+  };<br>
+<br>
+  A a0; // expected-error {{deleted}}<br>
+  A a1(0);<br>
+  B b0; // expected-error {{deleted}}<br>
+  B b1(0);<br>
+  B b2(0, 0);<br>
+  C c0; // expected-error {{deleted}}<br>
+  C c1(0);<br>
+  C c2(0, 0); // expected-note {{first required here}}<br>
+  D d0; // expected-error {{implicitly-deleted}}<br>
+  D d1(0);<br>
+  D d2(0, 0); // expected-note {{first required here}}<br>
+}<br>
+<br>
+namespace constexpr_init_order {<br>
+  struct Param;<br>
+  struct A {<br>
+    constexpr A(Param);<br>
+    int a;<br>
+  };<br>
+<br>
+  struct B : A { B(); using A::A; int b = 2; };<br>
+  extern const B b;<br>
+<br>
+  struct Param {<br>
+    constexpr Param(int c) : n(4 * b.a + b.b + c) {}<br>
+    int n;<br>
+  };<br>
+<br>
+  constexpr A::A(Param p) : a(p.n) {}<br>
+<br>
+  constexpr B b(1);<br>
+  constexpr B c(1);<br>
+  static_assert(b.a == 1, "p should be initialized before B() is executed");<br>
+  static_assert(c.a == 7, "b not initialzed properly");<br>
+}<br>
+<br>
+namespace default_args {<br>
+  // We work around a defect in P0136R1 where it would reject reasonable<br>
+  // code like the following:<br>
+  struct Base {<br>
+    Base(int = 0);<br>
+  };<br>
+  struct Derived : Base {<br>
+    using Base::Base;<br>
+  };<br>
+  Derived d;<br>
+  // FIXME: Once a fix is standardized, implement it.<br>
+}<br>
<br>
Added: cfe/trunk/test/CXX/special/<wbr>class.init/class.inhctor.init/<wbr>p2.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p2.cpp?rev=274049&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/CXX/<wbr>special/class.init/class.<wbr>inhctor.init/p2.cpp?rev=<wbr>274049&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CXX/special/<wbr>class.init/class.inhctor.init/<wbr>p2.cpp (added)<br>
+++ cfe/trunk/test/CXX/special/<wbr>class.init/class.inhctor.init/<wbr>p2.cpp Tue Jun 28 14:03:57 2016<br>
@@ -0,0 +1,33 @@<br>
+// RUN: %clang_cc1 -std=c++11 -verify %s<br>
+<br>
+namespace std_example {<br>
+  struct A { A(int); };<br>
+  struct B : A { using A::A; };<br>
+<br>
+  struct C1 : B { using B::B; };<br>
+  struct C2 : B { using B::B; };<br>
+<br>
+  struct D1 : C1, C2 {<br>
+    using C1::C1; // expected-note {{inherited from base class 'C1' here}}<br>
+    using C2::C2; // expected-note {{inherited from base class 'C2' here}}<br>
+  };<br>
+<br>
+  struct V1 : virtual B { using B::B; };<br>
+  struct V2 : virtual B { using B::B; };<br>
+<br>
+  struct D2 : V1, V2 {<br>
+    using V1::V1;<br>
+    using V2::V2;<br>
+  };<br>
+<br>
+  D1 d1(0); // expected-error {{constructor of 'A' inherited from multiple base class subobjects}}<br>
+  D2 d2(0); // OK: initializes virtual B base class, which initializes the A base class<br>
+            // then initializes the V1 and V2 base classes as if by a defaulted default constructor<br>
+<br>
+  struct M { M(); M(int); };<br>
+  struct N : M { using M::M; };<br>
+  struct O : M {};<br>
+  struct P : N, O { using N::N; using O::O; };<br>
+  P p(0); // OK: use M(0) to initialize N's base class,<br>
+          // use M() to initialize O's base class<br>
+}<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/<wbr>inheriting-constructor.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>CodeGenCXX/inheriting-<wbr>constructor.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CodeGenCXX/<wbr>inheriting-constructor.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/<wbr>inheriting-constructor.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1,4 +1,8 @@<br>
-// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s<br>
+// RUN: %clang_cc1 -std=c++11 -triple i386-linux -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=ITANIUM<br>
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-darwin -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=ITANIUM<br>
+// RUN: %clang_cc1 -std=c++11 -triple arm64-ehabi -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=ITANIUM<br>
+// RUN: %clang_cc1 -std=c++11 -triple i386-windows -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=MSABI --check-prefix=WIN32<br>
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-windows -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=MSABI --check-prefix=WIN64<br>
<br>
 // PR12219<br>
 struct A { A(int); virtual ~A(); };<br>
@@ -11,18 +15,396 @@ struct C { template<typename T> C(T); };<br>
 struct D : C { using C::C; };<br>
 D d(123);<br>
<br>
-// CHECK-LABEL: define void @_ZN1BD2Ev<br>
-// CHECK-LABEL: define void @_ZN1BD1Ev<br>
-// CHECK-LABEL: define void @_ZN1BD0Ev<br>
+// ITANIUM-LABEL: define void @_ZN1BD2Ev<br>
+// ITANIUM-LABEL: define void @_ZN1BD1Ev<br>
+// ITANIUM-LABEL: define void @_ZN1BD0Ev<br>
+// WIN32-LABEL: define {{.*}}void @"\01??1B@@UAE@XZ"<br>
+// WIN64-LABEL: define {{.*}}void @"\01??1B@@UEAA@XZ"<br>
<br>
-// CHECK-LABEL: define linkonce_odr void @_ZN1BC1Ei(<br>
-// CHECK: call void @_ZN1BC2Ei(<br>
+// ITANIUM-LABEL: define linkonce_odr void @_ZN1BCI11AEi(<br>
+// ITANIUM: call void @_ZN1BCI21AEi(<br>
<br>
-// CHECK-LABEL: define linkonce_odr void @_ZN1DC1IiEET_(<br>
-// CHECK: call void @_ZN1DC2IiEET_(<br>
+// ITANIUM-LABEL: define linkonce_odr void @_ZN1DCI11CIiEET_(<br>
+// ITANIUM: call void @_ZN1DCI21CIiEET_(<br>
<br>
-// CHECK-LABEL: define linkonce_odr void @_ZN1BC2Ei(<br>
-// CHECK: call void @_ZN1AC2Ei(<br>
+// WIN32-LABEL: define internal {{.*}} @"\01??0B@@QAE@H@Z"(<br>
+// WIN32: call {{.*}} @"\01??0A@@QAE@H@Z"(<br>
+// WIN64-LABEL: define internal {{.*}} @"\01??0B@@QEAA@H@Z"(<br>
+// WIN64: call {{.*}} @"\01??0A@@QEAA@H@Z"(<br>
<br>
-// CHECK-LABEL: define linkonce_odr void @_ZN1DC2IiEET_(<br>
-// CHECK: call void @_ZN1CC2IiEET_(<br>
+// WIN32-LABEL: define internal {{.*}} @"\01??0D@@QAE@H@Z"(<br>
+// WIN32: call {{.*}} @"\01??$?0H@C@@QAE@H@Z"<br>
+// WIN64-LABEL: define internal {{.*}} @"\01??0D@@QEAA@H@Z"(<br>
+// WIN64: call {{.*}} @"\01??$?0H@C@@QEAA@H@Z"<br>
+<br>
+struct Q { Q(int); Q(const Q&); ~Q(); };<br>
+struct Z { Z(); Z(int); ~Z(); int n; };<br>
+<br>
+namespace noninline_nonvirt {<br>
+  struct A { A(int, Q&&, void *__attribute__((pass_object_<wbr>size(0)))); int n; };<br>
+  struct B : Z, A { Z z; using A::A; };<br>
+  B b(1, 2, &b);<br>
+  // ITANIUM-LABEL: define {{.*}} @__cxx_global_var_init<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}} %[[TMP:.*]], i32 2)<br>
+  // ITANIUM: call void @_ZN17noninline_<wbr>nonvirt1BCI1NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0({{.*}} @_ZN17noninline_nonvirt1bE, i32 1, {{.*}} %[[TMP]], i8* {{.*}} @_ZN17noninline_nonvirt1bE{{.*<wbr>}}, i{{32|64}} 12)<br>
+  // ITANIUM: call void @_ZN1QD1Ev({{.*}} %[[TMP]])<br>
+  // ITANIUM: call i32 @__cxa_atexit(<br>
+<br>
+  // Complete object ctor for B delegates to base object ctor.<br>
+  // ITANIUM-LABEL: define linkonce_odr void @_ZN17noninline_<wbr>nonvirt1BCI1NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0(<br>
+  // ITANIUM: call void @_ZN17noninline_<wbr>nonvirt1BCI2NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0({{.*}}, i32 {{.*}}, %{{.*}}* {{.*}}, i8* {{.*}}, i{{32|64}} {{.*}})<br>
+<br>
+  // In MSABI, we don't have ctor variants. B ctor forwards to A ctor.<br>
+  // MSABI-LABEL: define internal {{.*}} @"\01??0B@noninline_nonvirt@@<wbr>Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{<wbr>E?}}AXW4__pass_object_size0@__<wbr>clang@@@Z"(%{{.*}}, i32{{.*}}, %{{.*}}, i8*{{.*}}, i{{32|64}}{{.*}})<br>
+  // MSABI: call {{.*}} @"\01??0Z@@Q{{AE|EAA}}@XZ"(<br>
+  // MSABI: call {{.*}} @"\01??0A@noninline_nonvirt@@<wbr>Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{<wbr>E?}}AXW4__pass_object_size0@__<wbr>clang@@@Z"(%{{.*}}, i32{{.*}}, %{{.*}}, i8*{{.*}}, i{{32|64}}{{.*}})<br>
+  // MSABI: call {{.*}} @"\01??0Z@@Q{{AE|EAA}}@XZ"(<br>
+<br>
+  struct C : B { using B::B; };<br>
+  C c(1, 2, &c);<br>
+  // Complete object ctor for C delegates.<br>
+  // ITANIUM-LABEL: define linkonce_odr void @_ZN17noninline_<wbr>nonvirt1CCI1NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0(<br>
+  // ITANIUM: call void @_ZN17noninline_<wbr>nonvirt1CCI2NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0({{.*}}, i32 {{.*}}, %{{.*}}* {{.*}}, i8* {{.*}}, i{{32|64}} {{.*}})<br>
+<br>
+  // MSABI-LABEL: define internal {{.*}} @"\01??0C@noninline_nonvirt@@<wbr>Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{<wbr>E?}}AXW4__pass_object_size0@__<wbr>clang@@@Z"(%{{.*}}, i32{{.*}}, %{{.*}}, i8*{{.*}}, i{{32|64}}{{.*}})<br>
+  // MSABI: call {{.*}} @"\01??0B@noninline_nonvirt@@<wbr>Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{<wbr>E?}}AXW4__pass_object_size0@__<wbr>clang@@@Z"(%{{.*}}, i32{{.*}}, %{{.*}}, i8*{{.*}}, i{{32|64}}{{.*}})<br>
+}<br>
+<br>
+namespace noninline_virt {<br>
+  struct A { A(int, Q&&, void *__attribute__((pass_object_<wbr>size(0)))); int n; };<br>
+  struct B : Z, virtual A { Z z; using A::A; };<br>
+  B b(1, 2, &b);<br>
+  // Complete object ctor forwards to A ctor then constructs Zs.<br>
+  // ITANIUM-LABEL: define linkonce_odr void @_ZN14noninline_virt1BCI1NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0(<br>
+  // ITANIUM: call void @_ZN14noninline_<wbr>virt1AC2EiO1QPvU17pass_object_<wbr>size0({{.*}} %{{.*}}, i32 %{{.*}}, %{{.*}}* {{.*}}, i8* {{.*}}, i{{32|64}} %{{.*}}<br>
+  // ITANIUM: call void @_ZN1ZC2Ev(<br>
+  // ITANIUM: store {{.*}} @_ZTVN14noninline_virt1BE<br>
+  // ITANIUM: call void @_ZN1ZC1Ev(<br>
+<br>
+  // MSABI-LABEL: define internal {{.*}} @"\01??0B@noninline_virt@@Q{{<wbr>AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}<wbr>}AXW4__pass_object_size0@__<wbr>clang@@@Z"(%{{.*}}, i32{{.*}}, %{{.*}}, i8*{{.*}}, i{{32|64}}{{.*}}, i32 %{{.*}})<br>
+  // MSABI: %[[COMPLETE:.*]] = icmp ne<br>
+  // MSABI: br i1 %[[COMPLETE]],<br>
+  // MSABI: call {{.*}} @"\01??0A@noninline_virt@@Q{{<wbr>AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}<wbr>}AXW4__pass_object_size0@__<wbr>clang@@@Z"(%{{.*}}, i32{{.*}}, %{{.*}}, i8*{{.*}}, i{{32|64}}{{.*}})<br>
+  // MSABI: br<br>
+  // MSABI: call {{.*}} @"\01??0Z@@Q{{AE|EAA}}@XZ"(<br>
+  // MSABI: call {{.*}} @"\01??0Z@@Q{{AE|EAA}}@XZ"(<br>
+<br>
+  struct C : B { using B::B; };<br>
+  C c(1, 2, &c);<br>
+  // Complete object ctor forwards to A ctor, then calls B's base inheriting<br>
+  // constructor, which takes no arguments other than the this pointer and VTT.<br>
+  // ITANIUM_LABEL: define linkonce_odr void @_ZN14noninline_virt1CCI1NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0(<br>
+  // ITANIUM: call void @_ZN14noninline_<wbr>virt1AC2EiO1QPvU17pass_object_<wbr>size0({{.*}} %{{.*}}, i32 %{{.*}}, %{{.*}}* {{.*}}, i8* %{{.*}}, i{{32|64}} %{{.*}})<br>
+  // ITANIUM: call void @_ZN14noninline_virt1BCI2NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0(%{{.*}}* %{{.*}}, i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @_ZTTN14noninline_virt1CE, i64 0, i64 1))<br>
+  // ITANIUM: store {{.*}} @_ZTVN14noninline_virt1CE<br>
+<br>
+  // C constructor forwards to B constructor and A constructor. We pass the args<br>
+  // to both. FIXME: Can we pass undef here instead, for the base object<br>
+  // constructor call?<br>
+  // MSABI-LABEL: define internal {{.*}} @"\01??0C@noninline_virt@@Q{{<wbr>AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}<wbr>}AXW4__pass_object_size0@__<wbr>clang@@@Z"(%{{.*}}, i32{{.*}}, %{{.*}}, i8*{{.*}}, i{{32|64}}{{.*}}, i32 %{{.*}})<br>
+  // MSABI: %[[COMPLETE:.*]] = icmp ne<br>
+  // MSABI: br i1 %[[COMPLETE]],<br>
+  // MSABI: call {{.*}} @"\01??0A@noninline_virt@@Q{{<wbr>AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}<wbr>}AXW4__pass_object_size0@__<wbr>clang@@@Z"(%{{.*}}, i32{{.*}}, %{{.*}}, i8*{{.*}}, i{{32|64}}{{.*}})<br>
+  // MSABI: br<br>
+  // MSABI: call {{.*}} @"\01??0B@noninline_virt@@Q{{<wbr>AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}<wbr>}AXW4__pass_object_size0@__<wbr>clang@@@Z"(%{{.*}}, i32{{.*}}, %{{.*}}, i8*{{.*}}, i{{32|64}}{{.*}}, i32 0)<br>
+}<br>
+<br>
+// For MSABI only, check that inalloca arguments result in inlining.<br>
+namespace inalloca_nonvirt {<br>
+  struct A { A(Q, int, Q, Q&&); int n; };<br>
+  struct B : Z, A { Z z; using A::A; };<br>
+  B b(1, 2, 3, 4);<br>
+  // No inlining implied for Itanium.<br>
+  // ITANIUM-LABEL: define linkonce_odr void @_ZN16inalloca_nonvirt1BCI1NS_<wbr>1AEE1QiS1_OS1_(<br>
+  // ITANIUM: call void @_ZN16inalloca_nonvirt1BCI2NS_<wbr>1AEE1QiS1_OS1_(<br>
+<br>
+  // MSABI-LABEL: define internal void @"\01??__Eb@inalloca_nonvirt@@<wbr>YAXXZ"(<br>
+<br>
+  // On Win32, the inalloca call can't be forwarded so we force inlining.<br>
+  // WIN32: %[[TMP:.*]] = alloca<br>
+  // WIN32: call i8* @llvm.stacksave()<br>
+  // WIN32: %[[ARGMEM:.*]] = alloca inalloca<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"(%{{.*}}* %[[TMP]], i32 4)<br>
+  // WIN32: %[[ARG3:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"({{.*}}* %[[ARG3]], i32 3)<br>
+  // WIN32: %[[ARG1:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"({{.*}}* %[[ARG1]], i32 1)<br>
+  // WIN32: call {{.*}} @"\01??0Z@@QAE@XZ"(<br>
+  // WIN32: %[[ARG2:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: store i32 2, i32* %[[ARG2]]<br>
+  // WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: store {{.*}}* %[[TMP]], {{.*}}** %[[ARG4]]<br>
+  // WIN32: call {{.*}} @"\01??0A@inalloca_nonvirt@@<wbr>QAE@UQ@@H0$$QAU2@@Z"(%{{[^,]*}<wbr>}, <{{.*}}>* inalloca %[[ARGMEM]])<br>
+  // WIN32: call void @llvm.stackrestore(<br>
+  // WIN32: call {{.*}} @"\01??0Z@@QAE@XZ"(<br>
+  // WIN32: call {{.*}} @"\01??_DQ@@QAE@XZ"(<br>
+<br>
+  // On Win64, the Q arguments would be destroyed in the callee. We don't yet<br>
+  // support that in the non-inlined case, so we force inlining.<br>
+  // WIN64: %[[TMP:.*]] = alloca<br>
+  // WIN64: %[[ARG3:.*]] = alloca<br>
+  // WIN64: %[[ARG1:.*]] = alloca<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[TMP]], i32 4)<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[ARG3]], i32 3)<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[ARG1]], i32 1)<br>
+  // WIN64: call {{.*}} @"\01??0Z@@QEAA@XZ"(<br>
+  // WIN64: call {{.*}} @"\01??0A@inalloca_nonvirt@@<wbr>QEAA@UQ@@H0$$QEAU2@@Z"(%{{.*}}<wbr>, %{{.*}}* %[[ARG1]], i32 2, %{{.*}}* %[[ARG3]], %{{.*}} %[[TMP]])<br>
+  // WIN64: call {{.*}} @"\01??0Z@@QEAA@XZ"(<br>
+  // WIN64: call void @"\01??_DQ@@QEAA@XZ"({{.*}}* %[[TMP]])<br>
+<br>
+  struct C : B { using B::B; };<br>
+  C c(1, 2, 3, 4);<br>
+  // MSABI-LABEL: define internal void @"\01??__Ec@inalloca_nonvirt@@<wbr>YAXXZ"(<br>
+<br>
+  // On Win32, the inalloca call can't be forwarded so we force inlining.<br>
+  // WIN32: %[[TMP:.*]] = alloca<br>
+  // WIN32: call i8* @llvm.stacksave()<br>
+  // WIN32: %[[ARGMEM:.*]] = alloca inalloca<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"(%{{.*}}* %[[TMP]], i32 4)<br>
+  // WIN32: %[[ARG3:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"({{.*}}* %[[ARG3]], i32 3)<br>
+  // WIN32: %[[ARG1:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"({{.*}}* %[[ARG1]], i32 1)<br>
+  // WIN32: call {{.*}} @"\01??0Z@@QAE@XZ"(<br>
+  // WIN32: %[[ARG2:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: store i32 2, i32* %[[ARG2]]<br>
+  // WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: store {{.*}}* %[[TMP]], {{.*}}** %[[ARG4]]<br>
+  // WIN32: call {{.*}} @"\01??0A@inalloca_nonvirt@@<wbr>QAE@UQ@@H0$$QAU2@@Z"(%{{[^,]*}<wbr>}, <{{.*}}>* inalloca %[[ARGMEM]])<br>
+  // WIN32: call void @llvm.stackrestore(<br>
+  // WIN32: call {{.*}} @"\01??0Z@@QAE@XZ"(<br>
+  // WIN32: call {{.*}} @"\01??_DQ@@QAE@XZ"(<br>
+<br>
+  // On Win64, the Q arguments would be destroyed in the callee. We don't yet<br>
+  // support that in the non-inlined case, so we force inlining.<br>
+  // WIN64: %[[TMP:.*]] = alloca<br>
+  // WIN64: %[[ARG3:.*]] = alloca<br>
+  // WIN64: %[[ARG1:.*]] = alloca<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[TMP]], i32 4)<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[ARG3]], i32 3)<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[ARG1]], i32 1)<br>
+  // WIN64: call {{.*}} @"\01??0Z@@QEAA@XZ"(<br>
+  // WIN64: call {{.*}} @"\01??0A@inalloca_nonvirt@@<wbr>QEAA@UQ@@H0$$QEAU2@@Z"(%{{.*}}<wbr>, %{{.*}}* %[[ARG1]], i32 2, %{{.*}}* %[[ARG3]], %{{.*}} %[[TMP]])<br>
+  // WIN64: call {{.*}} @"\01??0Z@@QEAA@XZ"(<br>
+  // WIN64: call void @"\01??_DQ@@QEAA@XZ"({{.*}}* %[[TMP]])<br>
+}<br>
+<br>
+namespace inalloca_virt {<br>
+  struct A { A(Q, int, Q, Q&&); int n; };<br>
+  struct B : Z, virtual A { Z z; using A::A; };<br>
+  B b(1, 2, 3, 4);<br>
+<br>
+  // MSABI-LABEL: define internal void @"\01??__Eb@inalloca_virt@@<wbr>YAXXZ"(<br>
+<br>
+  // On Win32, the inalloca call can't be forwarded so we force inlining.<br>
+  // WIN32: %[[TMP:.*]] = alloca<br>
+  // WIN32: call i8* @llvm.stacksave()<br>
+  // WIN32: %[[ARGMEM:.*]] = alloca inalloca<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"(%{{.*}}* %[[TMP]], i32 4)<br>
+  // WIN32: %[[ARG3:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"({{.*}}* %[[ARG3]], i32 3)<br>
+  // WIN32: %[[ARG1:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"({{.*}}* %[[ARG1]], i32 1)<br>
+  // FIXME: It's dumb to round-trip this though memory and generate a branch.<br>
+  // WIN32: store i32 1, i32* %[[IS_MOST_DERIVED_ADDR:.*]]<br>
+  // WIN32: %[[IS_MOST_DERIVED:.*]] = load i32, i32* %[[IS_MOST_DERIVED_ADDR]]<br>
+  // WIN32: %[[IS_MOST_DERIVED_i1:.*]] = icmp ne i32 %[[IS_MOST_DERIVED]], 0<br>
+  // WIN32: br i1 %[[IS_MOST_DERIVED_i1]]<br>
+  //<br>
+  // WIN32: store {{.*}} @"\01??_8B@inalloca_virt@@7B@"<br>
+  // WIN32: %[[ARG2:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: store i32 2, i32* %[[ARG2]]<br>
+  // WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: store {{.*}}* %[[TMP]], {{.*}}** %[[ARG4]]<br>
+  // WIN32: call {{.*}} @"\01??0A@inalloca_virt@@QAE@<wbr>UQ@@H0$$QAU2@@Z"(%{{[^,]*}}, <{{.*}}>* inalloca %[[ARGMEM]])<br>
+  // WIN32: call void @llvm.stackrestore(<br>
+  // WIN32: br<br>
+  //<br>
+  // Note that if we jumped directly to here we would fail to stackrestore and<br>
+  // destroy the parameters, but that's not actually possible.<br>
+  // WIN32: call {{.*}} @"\01??0Z@@QAE@XZ"(<br>
+  // WIN32: call {{.*}} @"\01??0Z@@QAE@XZ"(<br>
+  // WIN32: call {{.*}} @"\01??_DQ@@QAE@XZ"(<br>
+<br>
+  // On Win64, the Q arguments would be destroyed in the callee. We don't yet<br>
+  // support that in the non-inlined case, so we force inlining.<br>
+  // WIN64: %[[TMP:.*]] = alloca<br>
+  // WIN64: %[[ARG3:.*]] = alloca<br>
+  // WIN64: %[[ARG1:.*]] = alloca<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[TMP]], i32 4)<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[ARG3]], i32 3)<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[ARG1]], i32 1)<br>
+  // WIN64: br i1<br>
+  // WIN64: call {{.*}} @"\01??0A@inalloca_virt@@QEAA@<wbr>UQ@@H0$$QEAU2@@Z"(%{{.*}}, %{{.*}}* %[[ARG1]], i32 2, %{{.*}}* %[[ARG3]], %{{.*}} %[[TMP]])<br>
+  // WIN64: br<br>
+  // WIN64: call {{.*}} @"\01??0Z@@QEAA@XZ"(<br>
+  // WIN64: call {{.*}} @"\01??0Z@@QEAA@XZ"(<br>
+  // WIN64: call void @"\01??_DQ@@QEAA@XZ"({{.*}}* %[[TMP]])<br>
+<br>
+  struct C : B { using B::B; };<br>
+  C c(1, 2, 3, 4);<br>
+  // ITANIUM-LABEL: define linkonce_odr void @_ZN13inalloca_virt1CD1Ev(<br>
+<br>
+  // MSABI-LABEL: define internal void @"\01??__Ec@inalloca_virt@@<wbr>YAXXZ"(<br>
+<br>
+  // On Win32, the inalloca call can't be forwarded so we force inlining.<br>
+  // WIN32: %[[TMP:.*]] = alloca<br>
+  // WIN32: call i8* @llvm.stacksave()<br>
+  // WIN32: %[[ARGMEM:.*]] = alloca inalloca<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"(%{{.*}}* %[[TMP]], i32 4)<br>
+  // WIN32: %[[ARG3:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"({{.*}}* %[[ARG3]], i32 3)<br>
+  // WIN32: %[[ARG1:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: call {{.*}} @"\01??0Q@@QAE@H@Z"({{.*}}* %[[ARG1]], i32 1)<br>
+  // WIN32: store i32 1, i32* %[[IS_MOST_DERIVED_ADDR:.*]]<br>
+  // WIN32: %[[IS_MOST_DERIVED:.*]] = load i32, i32* %[[IS_MOST_DERIVED_ADDR]]<br>
+  // WIN32: %[[IS_MOST_DERIVED_i1:.*]] = icmp ne i32 %[[IS_MOST_DERIVED]], 0<br>
+  // WIN32: br i1 %[[IS_MOST_DERIVED_i1]]<br>
+  //<br>
+  // WIN32: store {{.*}} @"\01??_8C@inalloca_virt@@7B@"<br>
+  // WIN32: %[[ARG2:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: store i32 2, i32* %[[ARG2]]<br>
+  // WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]<br>
+  // WIN32: store {{.*}}* %[[TMP]], {{.*}}** %[[ARG4]]<br>
+  // WIN32: call {{.*}} @"\01??0A@inalloca_virt@@QAE@<wbr>UQ@@H0$$QAU2@@Z"(%{{[^,]*}}, <{{.*}}>* inalloca %[[ARGMEM]])<br>
+  // WIN32: call void @llvm.stackrestore(<br>
+  // WIN32: br<br>
+  //<br>
+  // WIN32: store i32 0, i32* %[[IS_MOST_DERIVED_ADDR:.*]]<br>
+  // WIN32: %[[IS_MOST_DERIVED:.*]] = load i32, i32* %[[IS_MOST_DERIVED_ADDR]]<br>
+  // WIN32: %[[IS_MOST_DERIVED_i1:.*]] = icmp ne i32 %[[IS_MOST_DERIVED]], 0<br>
+  // WIN32: br i1 %[[IS_MOST_DERIVED_i1]]<br>
+  //<br>
+  // Note: this block is unreachable.<br>
+  // WIN32: store {{.*}} @"\01??_8B@inalloca_virt@@7B@"<br>
+  // WIN32: br<br>
+  //<br>
+  // WIN32: call {{.*}} @"\01??0Z@@QAE@XZ"(<br>
+  // WIN32: call {{.*}} @"\01??0Z@@QAE@XZ"(<br>
+  // WIN32: call {{.*}} @"\01??_DQ@@QAE@XZ"(<br>
+<br>
+  // On Win64, the Q arguments would be destroyed in the callee. We don't yet<br>
+  // support that in the non-inlined case, so we force inlining.<br>
+  // WIN64: %[[TMP:.*]] = alloca<br>
+  // WIN64: %[[ARG3:.*]] = alloca<br>
+  // WIN64: %[[ARG1:.*]] = alloca<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[TMP]], i32 4)<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[ARG3]], i32 3)<br>
+  // WIN64: call {{.*}} @"\01??0Q@@QEAA@H@Z"({{.*}}* %[[ARG1]], i32 1)<br>
+  // WIN64: br i1<br>
+  // WIN64: store {{.*}} @"\01??_8C@inalloca_virt@@7B@"<br>
+  // WIN64: call {{.*}} @"\01??0A@inalloca_virt@@QEAA@<wbr>UQ@@H0$$QEAU2@@Z"(%{{.*}}, %{{.*}}* %[[ARG1]], i32 2, %{{.*}}* %[[ARG3]], %{{.*}} %[[TMP]])<br>
+  // WIN64: br<br>
+  // WIN64: br i1<br>
+  // (Unreachable block)<br>
+  // WIN64: store {{.*}} @"\01??_8B@inalloca_virt@@7B@"<br>
+  // WIN64: br<br>
+  // WIN64: call {{.*}} @"\01??0Z@@QEAA@XZ"(<br>
+  // WIN64: call {{.*}} @"\01??0Z@@QEAA@XZ"(<br>
+  // WIN64: call void @"\01??_DQ@@QEAA@XZ"({{.*}}* %[[TMP]])<br>
+}<br>
+<br>
+namespace inline_nonvirt {<br>
+  struct A { A(Q, int, Q, Q&&, ...); int n; };<br>
+  struct B : Z, A { Z z; using A::A; };<br>
+  B b(1, 2, 3, 4, 5, 6);<br>
+  // Inlined all the way down to the A ctor.<br>
+  // ITANIUM-LABEL: define {{.*}} @__cxx_global_var_init<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 1)<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 3)<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 4)<br>
+  // ITANIUM: %[[Z_BASE:.*]] = bitcast %{{.*}}* %[[THIS:.*]] to<br>
+  // ITANIUM: call void @_ZN1ZC2Ev(<br>
+  // ITANIUM: %[[B_CAST:.*]] = bitcast {{.*}} %[[THIS]]<br>
+  // ITANIUM: %[[A_CAST:.*]] = getelementptr {{.*}} %[[B_CAST]], i{{32|64}} 4<br>
+  // ITANIUM: %[[A:.*]] = bitcast {{.*}} %[[A_CAST]]<br>
+  // ITANIUM: call void ({{.*}}, ...) @_ZN14inline_<wbr>nonvirt1AC2E1QiS1_OS1_z(%{{.*}<wbr>}* %[[A]], {{.*}}, i32 2, {{.*}}, {{.*}}, i32 5, i32 6)<br>
+  // ITANIUM: %[[Z_MEMBER:.*]] = getelementptr {{.*}} %[[THIS]], i32 0, i32 2<br>
+  // ITANIUM: call void @_ZN1ZC1Ev({{.*}} %[[Z_MEMBER]])<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+<br>
+  struct C : B { using B::B; };<br>
+  C c(1, 2, 3, 4, 5, 6);<br>
+  // Inlined all the way down to the A ctor.<br>
+  // ITANIUM-LABEL: define {{.*}} @__cxx_global_var_init<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 1)<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 3)<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 4)<br>
+  // ITANIUM: %[[Z_BASE:.*]] = bitcast %{{.*}}* %[[THIS:.*]] to<br>
+  // ITANIUM: call void @_ZN1ZC2Ev(<br>
+  // ITANIUM: %[[B_CAST:.*]] = bitcast {{.*}} %[[THIS]]<br>
+  // ITANIUM: %[[A_CAST:.*]] = getelementptr {{.*}} %[[B_CAST]], i{{32|64}} 4<br>
+  // ITANIUM: %[[A:.*]] = bitcast {{.*}} %[[A_CAST]]<br>
+  // ITANIUM: call void ({{.*}}, ...) @_ZN14inline_<wbr>nonvirt1AC2E1QiS1_OS1_z(%{{.*}<wbr>}* %[[A]], {{.*}}, i32 2, {{.*}}, {{.*}}, i32 5, i32 6)<br>
+  // ITANIUM: %[[Z_MEMBER:.*]] = getelementptr {{.*}} %{{.*}}, i32 0, i32 2<br>
+  // ITANIUM: call void @_ZN1ZC1Ev({{.*}} %[[Z_MEMBER]])<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+}<br>
+<br>
+namespace inline_virt {<br>
+  struct A { A(Q, int, Q, Q&&, ...); int n; };<br>
+  struct B : Z, virtual A { Z z; using A::A; };<br>
+  B b(1, 2, 3, 4, 5, 6);<br>
+  // Inlined all the way down to the A ctor.<br>
+  // ITANIUM-LABEL: define {{.*}} @__cxx_global_var_init<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 1)<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 3)<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 4)<br>
+  // ITANIUM: %[[B_CAST:.*]] = bitcast {{.*}} %[[THIS:.*]]<br>
+  // ITANIUM: %[[A_CAST:.*]] = getelementptr {{.*}} %[[B_CAST]], i{{32|64}} {{12|16}}<br>
+  // ITANIUM: %[[A:.*]] = bitcast {{.*}} %[[A_CAST]]<br>
+  // ITANIUM: call void ({{.*}}, ...) @_ZN11inline_virt1AC2E1QiS1_<wbr>OS1_z(%{{.*}}* %[[A]], {{.*}}, i32 2, {{.*}}, {{.*}}, i32 5, i32 6)<br>
+  // ITANIUM: call void @_ZN1ZC2Ev(<br>
+  // ITANIUM: call void @_ZN1ZC1Ev(<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+<br>
+  struct C : B { using B::B; };<br>
+  C c(1, 2, 3, 4, 5, 6);<br>
+  // Inlined all the way down to the A ctor, except that we can just call the<br>
+  // B base inheriting constructor to construct that portion (it doesn't need<br>
+  // the forwarded arguments).<br>
+  // ITANIUM-LABEL: define {{.*}} @__cxx_global_var_init<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 1)<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 3)<br>
+  // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 4)<br>
+  // ITANIUM: %[[B_CAST:.*]] = bitcast {{.*}} %[[THIS:.*]]<br>
+  // ITANIUM: %[[A_CAST:.*]] = getelementptr {{.*}} %[[B_CAST]], i{{32|64}} {{12|16}}<br>
+  // ITANIUM: %[[A:.*]] = bitcast {{.*}} %[[A_CAST]]<br>
+  // ITANIUM: call void ({{.*}}, ...) @_ZN11inline_virt1AC2E1QiS1_<wbr>OS1_z(%{{.*}}* %[[A]], {{.*}}, i32 2, {{.*}}, {{.*}}, i32 5, i32 6)<br>
+  // ITANIUM: call void @_ZN11inline_virt1BCI2NS_<wbr>1AEE1QiS1_OS1_z({{[^,]*}}, i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @_ZTTN11inline_virt1CE, i64 0, i64 1))<br>
+  // ITANIUM: store {{.*}} @_ZTVN11inline_virt1CE<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+  // ITANIUM: call void @_ZN1QD1Ev(<br>
+<br>
+  // B base object inheriting constructor does not get passed arguments.<br>
+  // ITANIUM-LABEL: define linkonce_odr void @_ZN11inline_virt1BCI2NS_<wbr>1AEE1QiS1_OS1_z(<br>
+  // ITANIUM-NOT: call<br>
+  // ITANIUM: call void @_ZN1ZC2Ev(%struct.Z* %2)<br>
+  // ITANIUM-NOT: call<br>
+  // VTT -> vtable<br>
+  // ITANIUM: store<br>
+  // ITANIUM-NOT: call<br>
+  // ITANIUM: call void @_ZN1ZC1Ev(%struct.Z* %z)<br>
+  // ITANIUM-NOT: call<br>
+  // ITANIUM: }<br>
+}<br>
+<br>
+// ITANIUM-LABEL: define linkonce_odr void @_ZN1BCI21AEi(<br>
+// ITANIUM: call void @_ZN1AC2Ei(<br>
+<br>
+// ITANIUM-LABEL: define linkonce_odr void @_ZN1DCI21CIiEET_(<br>
+// ITANIUM: call void @_ZN1CC2IiEET_(<br>
+<br>
+// ITANIUM-LABEL: define linkonce_odr void @_ZN17noninline_<wbr>nonvirt1BCI2NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0(<br>
+// ITANIUM: call void @_ZN1ZC2Ev(<br>
+// ITANIUM: call void @_ZN17noninline_<wbr>nonvirt1AC2EiO1QPvU17pass_<wbr>object_size0(<br>
+<br>
+// ITANIUM-LABEL: define linkonce_odr void @_ZN17noninline_<wbr>nonvirt1CCI2NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0(<br>
+// ITANIUM: call void @_ZN17noninline_<wbr>nonvirt1BCI2NS_<wbr>1AEEiO1QPvU17pass_object_<wbr>size0(<br>
<br>
Modified: cfe/trunk/test/PCH/cxx11-<wbr>inheriting-ctors.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx11-inheriting-ctors.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/PCH/<wbr>cxx11-inheriting-ctors.cpp?<wbr>rev=274049&r1=274048&r2=<wbr>274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/PCH/cxx11-<wbr>inheriting-ctors.cpp (original)<br>
+++ cfe/trunk/test/PCH/cxx11-<wbr>inheriting-ctors.cpp Tue Jun 28 14:03:57 2016<br>
@@ -1,10 +1,19 @@<br>
-// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s<br>
-// RUN: %clang_cc1 -std=c++11 -include-pch %t -verify %s<br>
+// RUN: %clang_cc1 -std=c++11 -include %s -include %s -verify %s<br>
+//<br>
+// Emit with definitions in the declaration:<br>
+// RxN: %clang_cc1 -std=c++11 -emit-pch -o %t.12 -include %s %s<br>
+// RxN: %clang_cc1 -std=c++11 -include-pch %t.12 -verify %s<br>
+//<br>
+// Emit with definitions in update records:<br>
+// RxN: %clang_cc1 -std=c++11 -emit-pch -o %t.1 %s<br>
+// RxN: %clang_cc1 -std=c++11 -include-pch %t.1 -emit-pch -o %t.2 -verify %s<br>
+// RxN: %clang_cc1 -std=c++11 -include-pch %t.1 -include-pch %t.2 -verify %s<br>
+<br>
<br>
 // expected-no-diagnostics<br>
<br>
-#ifndef HEADER_INCLUDED<br>
-#define HEADER_INCLUDED<br>
+#ifndef HEADER1<br>
+#define HEADER1<br>
<br>
 struct Base {<br>
   Base(int) {}<br>
@@ -27,7 +36,8 @@ struct Test3 : B {<br>
   using B::B;<br>
 };<br>
<br>
-#else<br>
+#elif !defined(HEADER2)<br>
+#define HEADER2<br>
<br>
 Test test1a(42);<br>
 Test test1b(nullptr);<br>
@@ -36,4 +46,16 @@ Test2<int> test2b(nullptr);<br>
 Test3<Base> test3a(42);<br>
 Test3<Base> test3b(nullptr);<br>
<br>
-#endif // HEADER_INCLUDED<br>
+#pragma clang __debug dump Test<br>
+#pragma clang __debug dump Test2<br>
+<br>
+#else<br>
+<br>
+Test retest1a(42);<br>
+Test retest1b(nullptr);<br>
+Test2<int> retest2a(42);<br>
+Test2<int> retest2b(nullptr);<br>
+Test3<Base> retest3a(42);<br>
+Test3<Base> retest3b(nullptr);<br>
+<br>
+#endif<br>
<br>
Modified: cfe/trunk/test/SemaCXX/<wbr>constant-expression-cxx11.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>SemaCXX/constant-expression-<wbr>cxx11.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/SemaCXX/<wbr>constant-expression-cxx11.cpp (original)<br>
+++ cfe/trunk/test/SemaCXX/<wbr>constant-expression-cxx11.cpp Tue Jun 28 14:03:57 2016<br>
@@ -2029,3 +2029,40 @@ namespace IncompleteClass {<br>
     static constexpr int j = g(static_cast<XX*>(nullptr)); // expected-error {{constexpr variable 'j' must be initialized by a constant expression}}  expected-note {{undefined function 'g' cannot be used in a constant expression}}<br>
   };<br>
 }<br>
+<br>
+namespace InheritedCtor {<br>
+  struct A { constexpr A(int) {} };<br>
+<br>
+  struct B : A { int n; using A::A; }; // expected-note {{here}}<br>
+  constexpr B b(0); // expected-error {{constant expression}} expected-note {{derived class}}<br>
+<br>
+  struct C : A { using A::A; struct { union { int n, m = 0; }; union { int a = 0; }; int k = 0; }; struct {}; union {}; }; // expected-warning 4{{extension}}<br>
+  constexpr C c(0);<br>
+<br>
+  struct D : A {<br>
+    using A::A; // expected-note {{here}}<br>
+    struct { // expected-warning {{extension}}<br>
+      union { // expected-warning {{extension}}<br>
+        int n;<br>
+      };<br>
+    };<br>
+  };<br>
+  constexpr D d(0); // expected-error {{constant expression}} expected-note {{derived class}}<br>
+<br>
+  struct E : virtual A { using A::A; }; // expected-note {{here}}<br>
+  // We wrap a function around this to avoid implicit zero-initialization<br>
+  // happening first; the zero-initialization step would produce the same<br>
+  // error and defeat the point of this test.<br>
+  void f() {<br>
+    constexpr E e(0); // expected-error {{constant expression}} expected-note {{derived class}}<br>
+  }<br>
+  // FIXME: This produces a note with no source location.<br>
+  //constexpr E e(0);<br>
+<br>
+  struct W { constexpr W(int n) : w(n) {} int w; };<br>
+  struct X : W { using W::W; int x = 2; };<br>
+  struct Y : X { using X::X; int y = 3; };<br>
+  struct Z : Y { using Y::Y; int z = 4; };<br>
+  constexpr Z z(1);<br>
+  static_assert(z.w == 1 && z.x == 2 && z.y == 3 && z.z == 4, "");<br>
+}<br>
<br>
Modified: cfe/trunk/test/SemaCXX/cxx11-<wbr>inheriting-ctors.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-inheriting-ctors.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>SemaCXX/cxx11-inheriting-<wbr>ctors.cpp?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/SemaCXX/cxx11-<wbr>inheriting-ctors.cpp (original)<br>
+++ cfe/trunk/test/SemaCXX/cxx11-<wbr>inheriting-ctors.cpp Tue Jun 28 14:03:57 2016<br>
@@ -34,3 +34,13 @@ namespace WrongIdent {<br>
     using B::A;<br>
   };<br>
 }<br>
+<br>
+namespace DefaultCtorConflict {<br>
+  struct A { A(int = 0); };<br>
+  struct B : A {<br>
+    using A::A;<br>
+  } b; // ok, not ambiguous, inherited constructor suppresses implicit default constructor<br>
+  struct C {<br>
+    B b;<br>
+  } c;<br>
+}<br>
<br>
Modified: cfe/trunk/tools/libclang/<wbr>CIndex.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/tools/<wbr>libclang/CIndex.cpp?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/tools/libclang/<wbr>CIndex.cpp (original)<br>
+++ cfe/trunk/tools/libclang/<wbr>CIndex.cpp Tue Jun 28 14:03:57 2016<br>
@@ -3955,6 +3955,9 @@ static const Decl *getDeclFromExpr(const<br>
   if (const CXXConstructExpr *CE = dyn_cast<CXXConstructExpr>(E))<br>
     if (!CE->isElidable())<br>
     return CE->getConstructor();<br>
+  if (const CXXInheritedCtorInitExpr *CE =<br>
+          dyn_cast<<wbr>CXXInheritedCtorInitExpr>(E))<br>
+    return CE->getConstructor();<br>
   if (const ObjCMessageExpr *OME = dyn_cast<ObjCMessageExpr>(E))<br>
     return OME->getMethodDecl();<br>
<br>
@@ -5665,6 +5668,7 @@ CXCursor clang_getCursorDefinition(<wbr>CXCur<br>
                                        D->getLocation(), TU);<br>
<br>
   case Decl::UsingShadow:<br>
+  case Decl::ConstructorUsingShadow:<br>
     return clang_getCursorDefinition(<br>
                        MakeCXCursor(cast<<wbr>UsingShadowDecl>(D)-><wbr>getTargetDecl(),<br>
                                     TU));<br>
<br>
Modified: cfe/trunk/tools/libclang/<wbr>CXCursor.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.cpp?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/tools/<wbr>libclang/CXCursor.cpp?rev=<wbr>274049&r1=274048&r2=274049&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/tools/libclang/<wbr>CXCursor.cpp (original)<br>
+++ cfe/trunk/tools/libclang/<wbr>CXCursor.cpp Tue Jun 28 14:03:57 2016<br>
@@ -504,6 +504,7 @@ CXCursor cxcursor::MakeCXCursor(const St<br>
   case Stmt::CXXMemberCallExprClass:<br>
   case Stmt::CUDAKernelCallExprClass:<br>
   case Stmt::CXXConstructExprClass:<br>
+  case Stmt::<wbr>CXXInheritedCtorInitExprClass:<br>
   case Stmt::<wbr>CXXTemporaryObjectExprClass:<br>
   case Stmt::<wbr>CXXUnresolvedConstructExprClas<wbr>s:<br>
   case Stmt::UserDefinedLiteralClass:<br>
<br>
Modified: cfe/trunk/www/cxx_status.html<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=274049&r1=274048&r2=274049&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/www/cxx_<wbr>status.html?rev=274049&r1=<wbr>274048&r2=274049&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/www/cxx_status.html (original)<br>
+++ cfe/trunk/www/cxx_status.html Tue Jun 28 14:03:57 2016<br>
@@ -623,7 +623,7 @@ as the draft C++1z standard evolves.</p><br>
     <tr><br>
       <td>New specification for inheriting constructors (<a href="cxx_dr_status.html#1941"<wbr>>DR1941</a> et al)</td><br>
       <td><a href="<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0136r1.html" rel="noreferrer" target="_blank">http://www.open-std.org/<wbr>jtc1/sc22/wg21/docs/papers/<wbr>2015/p0136r1.html</a>">P0136R1</a><wbr></td><br>
-      <td class="none" align="center">No</td><br>
+      <td class="svn" align="center">SVN <a href="p0136">(9)</a></td><br>
     </tr><br>
     <!-- Jacksonville papers --><br>
     <tr><br>
@@ -735,6 +735,9 @@ all language versions that allow type de<br>
 (per the request of the C++ committee).<br>
 In Clang 3.7, a warning is emitted for all cases that would change meaning.<br>
 </span><br>
+<span id="p0136">(9): This is the resolution to a Defect Report, so is applied<br>
+to all language versions supporting inheriting constructors.<br>
+</span><br>
 </p><br>
<br>
 <h2 id="ts">Technical specifications and standing documents</h2><br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>