Topic: Defect report: 3.4.1/3: ill-formed example


Author: Christopher Yeleighton <krixel@qed.pl>
Date: Tue, 22 Nov 2005 00:13:57 +0000 (UTC)
Raw View
[ Forwarded to C++ Committee. -sdc ]

typedef int f;

struct A {

    friend void f(A &);

    operator int();

    void g(A a) {

        f(a);

    }

};



The declaration of void f(A &) introduces it into the global namespace by
3.3/4:"friend declarations (11.4) may introduce a (possibly not visible)
name into an enclosing namespace", where it conflicts with typedef int f.
It is ill-formed by 3.3/4 again, because the symbol 'f' designates two
different entities, neither of them designates a class and one of them does
not designate a function.



[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]