[gnu.gcc.bug] "const" confusion in gcc 1.36

andy@CSVAX.CALTECH.EDU (Andy Fyfe) (10/27/89)

I wasn't expecting the first 3 warnings generated by gcc in the
test program that follows.  I may be misunderstanding "const"
(which, at this point, wouldn't surprise me).  It's not clear
to me what the last message means.  If the word "const" is
eliminated, then the program no longer parses.  Since it's a
bit weird, I thought I'd include it.

$ cat test.c
typedef char **ptr;

extern int exec1(const char *path, const char **args);
extern int exec2(const char *path, const ptr args);

one(char *p, char **q)
{
    exec1(p, (const char **)q);		/* ok */
    exec1(p, (const ptr)q);		/* not ok? */
    exec1(p, (const typeof(q))q);	/* not ok? */

    exec2(p, (const char **)q);		/* not ok? */
    exec2(p, (const ptr)q);		/* ok */
    exec2(p, (const typeof(q))q);	/* ok */

    exec1(p, (const (typeof(q)))q);	/* extra parens change things! */
}
$ gcc -v
gcc version 1.36
$ gcc -S test.c
test.c: In function one:
test.c:9: warning: argument passing between incompatible pointer types
test.c:10: warning: argument passing between incompatible pointer types
test.c:12: warning: argument passing between incompatible pointer types
test.c:16: conversion to non-scalar type requested
$ gcc -S -Dconst= test.c
test.c: In function one:
test.c:16: parse error before `)'