[llvm-branch-commits] [cfe-branch] r310719 - Merging r310691:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 11 08:58:58 PDT 2017


Author: hans
Date: Fri Aug 11 08:58:58 2017
New Revision: 310719

URL: http://llvm.org/viewvc/llvm-project?rev=310719&view=rev
Log:
Merging r310691:
------------------------------------------------------------------------
r310691 | rsmith | 2017-08-10 19:04:19 -0700 (Thu, 10 Aug 2017) | 2 lines

PR33489: A function-style cast to a deduced class template specialization type is type-dependent if it can't be resolved due to a type-dependent argument.

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

Modified:
    cfe/branches/release_50/   (props changed)
    cfe/branches/release_50/lib/AST/ExprCXX.cpp
    cfe/branches/release_50/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp

Propchange: cfe/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 11 08:58:58 2017
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:308455,308722,308824,308897,308996,309058,309112-309113,309226,309263,309327,309382-309383,309488,309503,309523,309569,309607,309633,309636,309640,309722,309752,309975,310006,310057,310158,310191,310359
+/cfe/trunk:308455,308722,308824,308897,308996,309058,309112-309113,309226,309263,309327,309382-309383,309488,309503,309523,309569,309607,309633,309636,309640,309722,309752,309975,310006,310057,310158,310191,310359,310691
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_50/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/lib/AST/ExprCXX.cpp?rev=310719&r1=310718&r2=310719&view=diff
==============================================================================
--- cfe/branches/release_50/lib/AST/ExprCXX.cpp (original)
+++ cfe/branches/release_50/lib/AST/ExprCXX.cpp Fri Aug 11 08:58:58 2017
@@ -1052,7 +1052,9 @@ CXXUnresolvedConstructExpr::CXXUnresolve
           :Type->getType()->isRValueReferenceType()? VK_XValue
           :VK_RValue),
          OK_Ordinary,
-         Type->getType()->isDependentType(), true, true,
+         Type->getType()->isDependentType() ||
+             Type->getType()->getContainedDeducedType(),
+         true, true,
          Type->getType()->containsUnexpandedParameterPack()),
     Type(Type),
     LParenLoc(LParenLoc),

Modified: cfe/branches/release_50/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp?rev=310719&r1=310718&r2=310719&view=diff
==============================================================================
--- cfe/branches/release_50/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp (original)
+++ cfe/branches/release_50/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp Fri Aug 11 08:58:58 2017
@@ -286,6 +286,29 @@ namespace tuple_tests {
   }
 }
 
+namespace dependent {
+  template<typename T> struct X {
+    X(T);
+  };
+  template<typename T> int Var(T t) {
+    X x(t);
+    return X(x) + 1; // expected-error {{invalid operands}}
+  }
+  template<typename T> int Cast(T t) {
+    return X(X(t)) + 1; // expected-error {{invalid operands}}
+  }
+  template<typename T> int New(T t) {
+    return X(new X(t)) + 1; // expected-error {{invalid operands}}
+  };
+  template int Var(float); // expected-note {{instantiation of}}
+  template int Cast(float); // expected-note {{instantiation of}}
+  template int New(float); // expected-note {{instantiation of}}
+  template<typename T> int operator+(X<T>, int);
+  template int Var(int);
+  template int Cast(int);
+  template int New(int);
+}
+
 #else
 
 // expected-no-diagnostics




More information about the llvm-branch-commits mailing list