[cfe-dev] Problem parsing a simple C++ file.

Hurcan Solter hsolter at gmail.com
Sun Dec 2 11:05:58 PST 2012


I am trying to parse simple C++ class with CompilerInstance but get the
following error;

E:/mycpp_vc/classtest.cpp:3:1: error: unknown type name 'class'
class Test
^
E:/mycpp_vc/classtest.cpp:3:13: error: expected ';' after top level
declarator
class Test
               ^
               ;
My understanding is clang assumes the file is a C file and hence the error.
I've thought clang would deduce that the file is a C++ by its extension.
I've also tried setting ci.getLangOpts().CPlusPlus=1 before parsing to no
avail.

Is there something am I overlooking?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121202/770abe48/attachment.html>


More information about the cfe-dev mailing list