[llvm-branch-commits] [cfe-branch] r214751 - Merging r213834:
Bill Wendling
isanbard at gmail.com
Mon Aug 4 11:38:09 PDT 2014
Author: void
Date: Mon Aug 4 13:38:09 2014
New Revision: 214751
URL: http://llvm.org/viewvc/llvm-project?rev=214751&view=rev
Log:
Merging r213834:
------------------------------------------------------------------------
r213834 | rsmith | 2014-07-23 19:27:39 -0700 (Wed, 23 Jul 2014) | 4 lines
Take the canonical type when forming a canonical template argument with
'nullptr' value. Fixes profiling of such template arguments to always give the
same value.
------------------------------------------------------------------------
Modified:
cfe/branches/release_35/ (props changed)
cfe/branches/release_35/lib/Sema/SemaTemplate.cpp
cfe/branches/release_35/test/SemaTemplate/temp_arg_nontype_cxx11.cpp
Propchange: cfe/branches/release_35/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 4 13:38:09 2014
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:213609,213611,213613,213741,213840,213902,213912-213913,213993,213998-213999,214008,214050,214119,214208,214222,214369,214390,214471
+/cfe/trunk:213609,213611,213613,213741,213834,213840,213902,213912-213913,213993,213998-213999,214008,214050,214119,214208,214222,214369,214390,214471
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_35/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/lib/Sema/SemaTemplate.cpp?rev=214751&r1=214750&r2=214751&view=diff
==============================================================================
--- cfe/branches/release_35/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/branches/release_35/lib/Sema/SemaTemplate.cpp Mon Aug 4 13:38:09 2014
@@ -4438,7 +4438,8 @@ CheckTemplateArgumentAddressOfObjectOrFu
switch (NPV) {
case NPV_NullPointer:
S.Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
- Converted = TemplateArgument(ParamType, /*isNullPtr=*/true);
+ Converted = TemplateArgument(S.Context.getCanonicalType(ParamType),
+ /*isNullPtr=*/true);
return false;
case NPV_Error:
@@ -4633,7 +4634,8 @@ static bool CheckTemplateArgumentPointer
return true;
case NPV_NullPointer:
S.Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
- Converted = TemplateArgument(ParamType, /*isNullPtr*/true);
+ Converted = TemplateArgument(S.Context.getCanonicalType(ParamType),
+ /*isNullPtr*/true);
if (S.Context.getTargetInfo().getCXXABI().isMicrosoft())
S.RequireCompleteType(Arg->getExprLoc(), ParamType, 0);
return false;
@@ -5089,7 +5091,8 @@ ExprResult Sema::CheckTemplateArgument(N
case NPV_NullPointer:
Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
- Converted = TemplateArgument(ParamType, /*isNullPtr*/true);
+ Converted = TemplateArgument(Context.getCanonicalType(ParamType),
+ /*isNullPtr*/true);
return Arg;
}
}
Modified: cfe/branches/release_35/test/SemaTemplate/temp_arg_nontype_cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/test/SemaTemplate/temp_arg_nontype_cxx11.cpp?rev=214751&r1=214750&r2=214751&view=diff
==============================================================================
--- cfe/branches/release_35/test/SemaTemplate/temp_arg_nontype_cxx11.cpp (original)
+++ cfe/branches/release_35/test/SemaTemplate/temp_arg_nontype_cxx11.cpp Mon Aug 4 13:38:09 2014
@@ -8,3 +8,18 @@ namespace PR15360 {
f<int[3], int*, nullptr>(); // expected-note{{in instantiation of}}
}
}
+
+namespace CanonicalNullptr {
+ template<typename T> struct get { typedef T type; };
+ struct X {};
+ template<typename T, typename get<T *>::type P = nullptr> struct A {};
+ template<typename T, typename get<decltype((T(), nullptr))>::type P = nullptr> struct B {};
+ template<typename T, typename get<T X::*>::type P = nullptr> struct C {};
+
+ template<typename T> A<T> MakeA();
+ template<typename T> B<T> MakeB();
+ template<typename T> C<T> MakeC();
+ A<int> a = MakeA<int>();
+ B<int> b = MakeB<int>();
+ C<int> c = MakeC<int>();
+}
More information about the llvm-branch-commits
mailing list