Issue 1060: Declaring main with attributes

Authors: Jay Ghiron
Date: 2026-05-15
Submitted against: C23
Status: Open
Cross-references: 1013

main cannot be declared with the _Noreturn function specifier:

In a hosted environment, no function specifier(s) shall appear in a declaration of main.

(C23 6.7.5 "Function specifiers" paragraph 4.)

However, there does not appear to be any equivalent wording for the [[noreturn]] attribute directly preventing its use with main:

[[noreturn]]int main(){
for(;;);
}

It is worth noting that other translation units must equivalently use [[noreturn]], that is the following translation unit would cause undefined behavior in combination with the previous translation unit:

int main();

Additionally, it is unclear whether or not [[reproducible]] and [[unsequenced]] can be used on the type of main. See also issue 1013 which discusses type equivalence with these attributes. For the following questions, assume that the implementation is hosted and supports no additional types of main.

Question 1

Is the following definition of main valid?

[[noreturn]]int main(){
for(;;);
}

Question 2

Is the following definition of main valid?

int main()[[reproducible]]{}

Question 3

Is the following definition of main valid?

int main()[[unsequenced]]{}