https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122229

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
User error.
E.g. C23 says in 7.1.2/5:
"If used, a header shall be included outside
of any external declaration or definition, and it shall first be included
before the first reference to
any of the functions or objects it declares, or to any of the types or macros
it defines."
Now, <immintrin.h> is not a standard header defined by C23, but it does include
standard headers and even if it didn't, all the GCC implementation headers have
similar requirements to the standard headers.
Including something inside of a function is meant for user headers you have
full control of what exactly they do and in what context it is ok to include
them.

Reply via email to