[Bug c/18930] name clash in C?

2004-12-10 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-10 
18:33 ---
Not a bug:

typedef int i;
typedef char c;

i main (i c, c ** v)
{

}

c is injected right away after i c.


-- 
   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18930


[Bug c/18930] name clash in C?

2004-12-10 Thread jacob at engelbrecht dot dk

--- Additional Comments From jacob at engelbrecht dot dk  2004-12-10 23:30 
---
Then I do not understand why the second program is legal?
(After a bit of experimentation I found out that if the type name is used as
variable name then it can not be used as a typename again). I would
Think that either type names are in the same name space as variable names, and
then both programs should be erronous (This I think is correct after rereading K
 R), or they are in different namespaces and then both programs should be
correct (although it might be difficult or impossible to implement). 

The following piece of code does not bark when compiled unless JE is defined

typedef int i;
i main()
{
  i i;
#ifdef JE
  i p;
#endif
  return i = 1;
}

regards

Jacob

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18930