[cfe-commits] r152619 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/CXX/temp/temp.param/p5.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Tue Mar 13 00:21:50 PDT 2012
Author: rsmith
Date: Tue Mar 13 02:21:50 2012
New Revision: 152619
URL: http://llvm.org/viewvc/llvm-project?rev=152619&view=rev
Log:
Implement [temp.param]p5: the top-level cv-qualifiers on a non-type template
parameter's declaration are ignored when determining the parameter's type.
Added:
cfe/trunk/test/CXX/temp/temp.param/p5.cpp
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=152619&r1=152618&r2=152619&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Tue Mar 13 02:21:50 2012
@@ -643,8 +643,12 @@
T->isNullPtrType() ||
// If T is a dependent type, we can't do the check now, so we
// assume that it is well-formed.
- T->isDependentType())
- return T;
+ T->isDependentType()) {
+ // C++ [temp.param]p5: The top-level cv-qualifiers on the template-parameter
+ // are ignored when determining its type.
+ return T.getUnqualifiedType();
+ }
+
// C++ [temp.param]p8:
//
// A non-type template-parameter of type "array of T" or
Added: cfe/trunk/test/CXX/temp/temp.param/p5.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p5.cpp?rev=152619&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p5.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p5.cpp Tue Mar 13 02:21:50 2012
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -verify %s -std=c++11
+
+template<const int I> struct S {
+ decltype(I) n;
+ int &&r = I;
+};
+S<5> s;
+
+template<typename T, T v> struct U {
+ decltype(v) n;
+ int &&r = v;
+};
+U<const int, 6> u;
More information about the cfe-commits
mailing list