Hi,

Small patch for the merging of typedef as defined in C++ std. So this become
valid in c++ mode:

===============
typedef int I;
typedef int J;
typedef J L;
typedef int I;
typedef L I;
typedef I I;
===============

However this code should produce an error (and don't):

===============
struct complex { /* ... */ };
typedef int complex; // error: redefinition
===============

but since at the time, tag name are in a different identifier namespace as
typedef even in C++, the function of merging is note called.

I don't have the C standard and didn't find the equivalent of

  /// IdentifierNamespace - According to C99 6.2.3, there are four
namespaces,
  /// labels, tags, members and ordinary identifiers.

In the C++ std. I suppose it has been remplaced by 3.4 name lookup
[basic.lookup]:

The name lookup rules apply uniformly to all names (including typedef-names
(7.1.3), namespace-names
(7.3) and class-names (9.1)) wherever the grammar allows such names in the
context discussed by a particular rule.

-- 
Cédric Venet


Attachment: CppMergedTypedef.patch
Description: Binary data

_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Reply via email to