candidate function chosen improperly in type dependent context #7768
Labels
bugzilla
Issues migrated from bugzilla
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
wontfix
Issue is real, but we can't or won't fix it. Not invalid
Extended Description
Clang (and gcc and comeau) accept the following invalid program:
static void test1(int *) { }
template
int *test2(const T &) { return 0; }
template
void test3(const T &t) {
test1(test2(t));
}
The statement "test1(test2(t))" is type-dependent all the way through to test1. 14.6.4.2/1 second bullet states:
"For the part of the lookup using associated namespace (3.4.2), only function declarations with external linkage found in either the template definition context or the template instantiation context are found."
test1() does not have external linkage. If we remove 'static' or change test1 to ::test1 (see the rest of the referenced section) then the program becomes valid.
The text was updated successfully, but these errors were encountered: