r179078 - Mark as referenced the functions from instantiated UserDefinedLiterals.
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Apr 8 18:17:02 PDT 2013
Author: akirtzidis
Date: Mon Apr 8 20:17:02 2013
New Revision: 179078
URL: http://llvm.org/viewvc/llvm-project?rev=179078&view=rev
Log:
Mark as referenced the functions from instantiated UserDefinedLiterals.
Fixes rdar://13589856
Added:
cfe/trunk/test/SemaCXX/cxx11-user-defined-literals-unused.cpp
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=179078&r1=179077&r2=179078&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Mon Apr 8 20:17:02 2013
@@ -6173,6 +6173,8 @@ TreeTransform<Derived>::TransformCharact
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *E) {
+ if (FunctionDecl *FD = E->getDirectCallee())
+ SemaRef.MarkFunctionReferenced(E->getLocStart(), FD);
return SemaRef.MaybeBindToTemporary(E);
}
Added: cfe/trunk/test/SemaCXX/cxx11-user-defined-literals-unused.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-user-defined-literals-unused.cpp?rev=179078&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx11-user-defined-literals-unused.cpp (added)
+++ cfe/trunk/test/SemaCXX/cxx11-user-defined-literals-unused.cpp Mon Apr 8 20:17:02 2013
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s -Wunused
+
+namespace {
+double operator"" _x(long double value) { return double(value); }
+int operator"" _ii(long double value) { return int(value); } // expected-warning {{not needed and will not be emitted}}
+}
+
+namespace rdar13589856 {
+ template<class T> double value() { return 3.2_x; }
+ template<class T> int valuei() { return 3.2_ii; }
+
+ double get_value() { return value<double>(); }
+}
More information about the cfe-commits
mailing list