const vars are not integer constant expressions; your code is not guaranteed to work. Some gnu exts are implemented; this one is not.

On Thu, 14 Apr 2022, Ziyao wrote:

Hi list,

I recently found that TinyCC complaint about code like this

int main(void)
{
        const int one = 1;
        static const int a = one;       // error: initializer element is
                                        // not constant
        return 0;
}

But GCC10 and Clang11 both accept it.

Ziyao


_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to