Mark as referenced the functions from instantiated UserDefinedLiterals.

Fixes rdar://13589856

llvm-svn: 179078
This commit is contained in:
Argyrios Kyrtzidis 2013-04-09 01:17:02 +00:00
parent ec1c0b3faa
commit 25049096cb
2 changed files with 15 additions and 0 deletions

View File

@ -6173,6 +6173,8 @@ TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *E) {
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *E) {
if (FunctionDecl *FD = E->getDirectCallee())
SemaRef.MarkFunctionReferenced(E->getLocStart(), FD);
return SemaRef.MaybeBindToTemporary(E);
}

View File

@ -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>(); }
}