Abdellazizhammami / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

class::enum types returned by functions can't be compiled #760

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

class myclass {
  enum mynum {
    E1, E2, E3 };
};

myclass::mynum dosomething() {
  return E2;
}

What is the expected output? 

I expect this to work as myclass:mynum is a legal type. It does work when 
compiling with avr-gcc 4.3.3 and avr-gcc 4.6.2.

What do you see instead?

The Arduino IDE utterly barfs itself to death on this, because it puts a big 
error into the sketch file massaged together internally, which contains

// Sketch summary info.
#include "Arduino.h"
mynum dosomething();

i.e. the "myclass::" has been stripped off.

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?

Confirmed problem with 0023, 1.0, and probably every other Arduino IDE version.
On openSUSE 11.4 and with duemilanove, allthough I doubt this matters at all.

The only way around this for now is to dumb down my program. :-(

Original issue reported on code.google.com by gooc...@top.geek.nz on 24 Dec 2011 at 7:14