[Bug c++/64596] Friendship not recognized and template param deduction error

petschy at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Feb 16 20:05:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64596

--- Comment #3 from petschy at gmail dot com ---
(In reply to Daniel Krügler from comment #2)

1) if the friend declaration is invalid in line 15, then g++ should tell me so,
shouldn't it? But atm it compiles it, and the surprise comes later, when the
private member can't be accessed, despite the friend decl.

Should I file a separate ticket about this? Any detail about why this
restriction about friend and alias templates is present in the std?

> 
> 	template<typename, bool>
> 	friend class Txn;

This would work, of course, but this form would give friend access to any Txn
on Str, even with different E template params. That might lead to subtle bugs
where invalid usage is not caught at compile time.

Thanks, Peter


More information about the Gcc-bugs mailing list