[cfe-dev] Why this extern "C" fails ?

Arji Cot arjicot at gmail.com
Mon Jul 29 06:56:36 PDT 2013


--------------

#include <iostream>

int main() {
  {
    extern "C" { int a = 42; }
    { std::cout << a << "\n"; }
  }
  return (0);
}

--------------

this code fails to compile and the compiler message alone

main.cpp:5:12: error: expected unqualified-id
    extern "C" { int a = 42; }
           ^
1 error generated.

It's not enough to me to explain why this is not working.

There is something that I'm missing ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130729/3ff19313/attachment.html>


More information about the cfe-dev mailing list