[cfe-dev] Is this a clang bug? "Foo::Foo::bar"

Richard Smith richard at metafoo.co.uk
Tue Jul 16 11:39:35 PDT 2013


That's a bug: llvm.org/PR15243

The standard wording used to be ambiguous here, the resolution chosen by
the committee didn't match clang's interpretation of the ambiguity, and
no-one has gotten around to fixing it yet. Patches would be welcome ;-)

On Tue, Jul 16, 2013 at 6:35 AM, Jonathan Sauer <jonathan.sauer at gmx.de>wrote:

> Hello,
>
> the following program compiles with clang r186311, and I'm not sure if
> this is a bug
> or correct behavior:
>
> struct Foo {
>     void bar();
> };
>
>
> void Foo::Foo::Foo::Foo::Foo::Foo::bar()
> {
> }
>
>
> According to §3.3.7p1 bullet 5 (basic.scope.class), the potential scope of
> a class
> includes "the regions defined by its member definitions [...] including
> the member
> function body and any portion of the declarator part of such definitions
> which follows
> the declarator-id", and §3.4.3.1p1 (class.qual) states that "A class
> member can be
> referred to using a qualified-id at any point in its potential scope"
> while "the name
> [specified after the nested-name-specifier] shall represent one or more
> members of
> that class or of one of its base classes."
>
> However in the code above the member function "bar" is referred to using a
> qualified-id
> in its declarator-id, which is not part of the class' potential scope, and
> "Foo" isn't
> a base class of itself, so this shouldn't be allowed.
>
> Still, I'm not sure if I got all the subtleties of C++'s name lookup rules
> right, so
> I'd like to make sure if this is a bug in clang or merely the somewhat
> amusing result
> of the way names in C++ can be specified.
>
>
> With many thanks in advance,
> Jonathan
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130716/252e254b/attachment.html>


More information about the cfe-dev mailing list