зеркало из https://github.com/microsoft/clang-1.git
When we take the address of a declaration to bind it to a non-type
template parameter, by sure to mark that declaration as "referenced". The Boost.Iterator library now passes all tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102256 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
f643b9b338
Коммит
77c13e0731
|
@ -2576,6 +2576,7 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
|
|||
|
||||
// Create the template argument.
|
||||
Converted = TemplateArgument(Entity->getCanonicalDecl());
|
||||
S.MarkDeclarationReferenced(Arg->getLocStart(), Entity);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,3 +176,20 @@ namespace PR6723 {
|
|||
f<512>(arr512); // expected-error{{no matching function for call}}
|
||||
}
|
||||
}
|
||||
|
||||
// Check that we instantiate declarations whose addresses are taken
|
||||
// for non-type template arguments.
|
||||
namespace EntityReferenced {
|
||||
template<typename T, void (*)(T)> struct X { };
|
||||
|
||||
template<typename T>
|
||||
struct Y {
|
||||
static void f(T x) {
|
||||
x = 1; // expected-error{{assigning to 'int *' from incompatible type 'int'}}
|
||||
}
|
||||
};
|
||||
|
||||
void g() {
|
||||
typedef X<int*, Y<int*>::f> x; // expected-note{{in instantiation of}}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче