Jump to content
Sign in to follow this  
jscrane

Compiler error with template parameter

Recommended Posts

Hi everyone,

I have a program which involves something like this:

template<unsigned N>
class Bar {
  public:
    char baz[N];
};

class Foo: public Bar<32> {
};

Unfortunately this fails to compile under Energia, with the following error message:

sketch_oct10a.cpp:0:19: error: expected ')' before numeric constant
sketch_oct10a.cpp:0:19: error: expected '>' before numeric constant
sketch_oct10a.cpp:0:19: error: expected unqualified-id before ')' token
sketch_oct10a.cpp:6:22: error: expected template-name before '<' token
sketch_oct10a.cpp:6:22: error: expected '{' before '<' token
sketch_oct10a.cpp:6:22: error: expected unqualified-id before '<' token

Since it compiles under Arduino, I'm guessing this is a bug in gcc version 4.6.3. This is an old compiler, from 2011. The compiler shipping with Arduino is gcc version 4.8.1, from 2013.

 

Then I discovered TI's gcc implementation of gcc, version 4.9.1 from 2014, and sure enough it compiles this code fragment in a standalone source file.

 

So my question is, has anyone any pointers to getting Energia to use this compiler instead of the default one? Failing that, is anyone working on updating the compiler shipping with Energia and if so, what the timescale is?

 

Thanks,

Steve

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...