C++ Logo

sg12

Advanced search

Re: [ub] What does "The function main shall not be used within a program" mean?

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 23 Jan 2014 01:05:01 +0200
On 23 January 2014 01:02, Gabriel Dos Reis <gdr_at_[hidden]> wrote:
>> It seems that gcc still allows this lovely piece of shenanigans:
>>
>> int main() {int y = sizeof(decltype(main)*);}
>>
>>
>> Should this be a core issue?
>
> why isn't it a gcc bug instead? Clearly it doesn't implement the rule consustently.


Sorry for being unclear, I meant the divergence in the sense that some
implementations
diagnose odr-uses of main, some of them diagnose all uses, modulo bugs.

Received on 2014-01-23 00:05:02