2016-03-29 1:08 GMT+06:00 Serge Pavlov <sepavl...@gmail.com>: > 2016-03-18 20:50 GMT+06:00 Richard Smith <rich...@metafoo.co.uk>: > >> rsmith added a comment. >> >> Can we instead not add the function to the redeclaration chain until it's >> instantiated (like we do if it's dependent)? >> >> > I prepared implementation that uses this approach. In this variant > information about potential definitions is lost, in some cases it makes > difficult to make analysis. For instance we can diagnose misfit of > declarations in the code: > ``` > void func9(int); // expected-note{{previous declaration is here}} > template<typename T> struct C9a { > friend int func9(int); // expected-error{{functions that differ only in > their return type cannot be overloaded}} > }; > ``` > but not in the case: > ``` > template<typename T> struct C9a { > friend int func9(int); > }; > void func9(int); > ``` > Otherwise both approaches seem almost equivalent. >
It looks like this is not an issue. In http://reviews.llvm.org/D16579 dependent friend are stored in a set for subsequent analysis. Nothing prevents from using the same approach for all friend functions. Thanks, --Serge
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits