Skip to content

Poor diagnostics with qualified name lookup #4362

@DougGregor

Description

@DougGregor
Bugzilla Link 3990
Resolution FIXED
Resolved on Mar 06, 2010 14:00
Version unspecified
OS All
CC @DougGregor

Extended Description

This code:

namespace N {
struct Wibble {
};

typedef Wibble foo;
}
using namespace N;

foo::bar x;

void f() {
foo::bar = 4;
}

Gives very poor diagnostics:

foo.cpp:9:6: error: unknown type name 'bar'
foo::bar x;

foo.cpp:12:6: error: no member named 'bar'
foo::bar  = 4;
~~~~~^
2 diagnostics generated.

For the first error, we should say something like:

  error: unknown type name 'foo::bar'

in the second case, perhaps

  error: no member named 'bar' in 'foo' (aka 'struct N::Wibble')

G++ does something like this:

foo.cpp:9: error: ‘bar’ in class ‘N::foo’ does not name a type
foo.cpp: In function ‘void f()’:
foo.cpp:12: error: ‘bar’ is not a member of ‘N::foo’

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions