[cfe-dev] Hello

Doug Gregor doug.gregor at gmail.com
Mon Oct 6 05:42:01 PDT 2008


On Sun, Oct 5, 2008 at 7:37 PM, Argiris Kirtzidis <akyrtzi at gmail.com> wrote:
> About the example:
>
> typedef int foo;
> namespace abc { foo bar(); }
> foo::abc::bar()
> {
>  // ...
> }
>
> Are you suggesting that we should have identical behavior as gcc (not
> emitting an error) ?
> This doesn't seem so important, particularly considering that it is
> going to be explicitly stated that an error is necessary.
> We already have minor incompatibilities with gcc, like the scoping of
> the 'condition' declarations in selection/iteration statements and some
> cases of declaration/expression ambiguity resolution.

If the standard says we're required to produce an error, then we
should produce an error. We don't want to get into the game of trying
to parse ill-formed code that other compilers happen to parse.
Building a standards-conforming C++ front end is hard enough as it is
:)

The best thing to do would be to make sure that there is a bug report
about each of these issues in GCC's bug database. If they fix the
problem, they'll be helping to migrate user code to be more
standards-conforming, and we'll have fewer issues when that code gets
compiled with Clang. And even if GCC doesn't fix the problem, at least
we can point to the report and say, "look, GCC knows the code is
wrong, too, but they haven't gotten around to diagnosing it."

It would also be useful to keep a list of these places where existing
compilers accept ill-formed code that Clang rejects. This list could
eventually be turned into some kind of "porting to Clang" guide.

  - Doug



More information about the cfe-dev mailing list