0

I stumbled across some behaviour that occours in conjunction with the C++11 PEG library PEGTL. Unfortunatly I'm not capable to reproduce this behaviour outside the libraries function/templates. This occured with Netbeans

A minimal example would look like this:

include <tao/pegtl.hpp>
using namespace tao::TAOCPP_PEGTL_NAMESPACE;

struct foo : istring<'f','o','o'> {};
struct bar : TAOCPP_PEGTL_ISTRING("foo") {};
struct foo2 : istring<'f','o','o'> {};

TAOCPP_PEGTL_ISTRING is a macro definition, that expands to istring<>, so TAOCPP_PEGTL_ISTRING("foo") is the same as istring<'f','o','o'>. GCC doesn't have a problem with that, but as soon as I try to use this Macro, it says

unexpected token: {
unexpected token: }
unknown identifier bar

and every following line gets errors too.

  • the struct foo line is fine
  • the struct bar line is where the error occurs
  • struct foo2 would be fine, but since the struct bar line generated an error, it's also displaying an error

highlighted error

highlighted error message box

Here is my System/Netbeans information:

Product Version: NetBeans IDE 8.2 (Build 201609270201)
Updates: NetBeans IDE is updated to version NetBeans 8.2 Patch 2
Java: 1.8.0_101; Java HotSpot(TM) 64-Bit Server VM 25.101-b13
Runtime: Java(TM) SE Runtime Environment 1.8.0_101-b13
System: Linux version 4.13.0-36-generic running on amd64; UTF-8; en_US (nb)
engelant
  • 121
  • 10
  • 1
    Do you have any compilation errors or is this just your IDE and C++ trying to outwit each other? – molbdnilo Feb 28 '18 at 20:02
  • It's just the IDE, gcc has no problems at all, it just breaks syntax highlighting and auto completion beyond the line I used the Macro. – engelant Feb 28 '18 at 20:08

0 Answers0