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

Gabriel Dos Reis gdr at microsoft.com
Thu Jan 23 00:23:37 CET 2014



> On Jan 22, 2014, at 3:05 PM, "Ville Voutilainen" <ville.voutilainen at gmail.com> wrote:
> 
> On 23 January 2014 01:02, Gabriel Dos Reis <gdr at microsoft.com> 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.

OK, thanks for the clarification.
You can fill an issue, but I but the rule is clear, even after in the introduction of the neologism odr-use.

-- Gaby


More information about the ub mailing list