23586 – [3.4 regression] Bad diagnostic for invalid namespace-name (original) (raw)

Description Volker Reichelt 2005-08-26 22:17:50 UTC

For an invalid code snippet like

int i; namespace N = i;

we issue the error message

bug.cc:2: error: expected namespace-name before ';' token bug.cc:2: error: unknown namespace ''

with the not very helpful ''.

The situation for the code snippet

int i; using namespace i;

is similar. Here we get the error message:

bug.cc:2: error: expected namespace-name before ';' token bug.cc:2: error: '' is not a namespace

With the old parser we got

bug.cc:2: error: unknown namespace `i'

resp.

bug.cc:2: error: namespace `i' undeclared

so this qualifies as a diagnostic regression.

I'll post a patch soon.

Comment 1 Drea Pinski 2005-08-26 22:20:02 UTC

Confirmed.

Comment 2 Volker Reichelt 2005-08-26 22:21:18 UTC

Btw, the problem is related to PR13377. The problem there is twofold: The compiler fails to report which name is not a namespace-name (N2) and why (because it's ambiguous).

The patch would only fix the first problem; the second would still remain.

Comment 5 Volker Reichelt 2005-08-30 16:28:19 UTC

Fixed on the 4.0 branch (for 4.0.2) and mainline.

Testing patch for the 3.4 branch.

Comment 6 Volker Reichelt 2005-08-31 08:32:09 UTC

Patch for the 3.4 branch posted.

Comment 8 Volker Reichelt 2005-08-31 10:17:27 UTC

Now also fixed on the 3.4 branch.