rsmith added inline comments.
================
Comment at: lib/Sema/SemaDecl.cpp:8657-8658
@@ +8656,4 @@
+ DeclContext *SemanticDC = D->getDeclContext();
+ if (SemanticDC->isDependentContext())
+ return false;
+ // Get here only for out-of-line declarations: lexical context is dependent,
----------------
I don't think this is right. Given:
template<typename T> void f() {
extern void g();
extern void g();
}
... we do want to link the two declarations of `g` together. We even want to
link them to a prior declaration of `::g` if there is one, since they have a
non-dependent type, otherwise we'll reject cases like:
void g();
constexpr void (*p)() = g;
template<bool> struct X { typedef int type; };
template<typename T> void f() {
extern void g();
X<&g == p>::type n; // note: no 'typename' required, not value-dependent,
} // must evaluate to 'true' while parsing the template
Perhaps we're trying to make this check too general, and we should instead only
make this new logic apply to the case of friend declarations. Are there any
cases where a friend declaration in a dependent context that names a non-member
function needs to be added to the redeclaration chain?
================
Comment at: lib/Sema/SemaDecl.cpp:8671-8673
@@ +8670,5 @@
+ //
+ // class C1 {
+ // friend void func<>(int);
+ // };
+ //
----------------
This is not an example that reaches this case, because the lexical context of
the function is not dependent.
https://reviews.llvm.org/D16989
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits