blog post about clang diagnostics

FYI, it's been too long since we've had a blog post, so I wrote this up tonight:

Thoughts and comments welcome!

-Chris

FYI, it's been too long since we've had a blog post, so I wrote this up tonight:
Amazing feats of Clang Error Recovery - The LLVM Project Blog

Thoughts and comments welcome!

Apologies in advance, because I know I'm being pedantic, *but*...

You wrote:

[...] if you comment out the two
using directives in the example above [...]

Many seasoned C++ programmers get this terminology wrong.

The aforementioned things in the example:

  using B1::f; using B2::f;

... are using-declarations, not using-directives. This might help to keep it straight:

A using-declaration is a *declaration* in the sense that it *declares* (introduces) a name in the scope where it appears.

A using-directive is not a declaration *at all*, and it doesn't introduce any names in the scope where it appears. It is a *directive* in the sense that it sort of *tells name lookup to behave differently* (whereas a declaration tends to alter just the input to name lookup but not the behavior).

And a using-directive always names a *namespace*.

namespace N{}
using namespace N; // ok

namespace Q{ void f(); }
using namespace Q::f(); // error (expected a namespace name)

... whereas a using-declaration can name just about anything that can be named with a qualified-id (with the exception of a template-id (grammar term)).

James Widman

fixed thanks.