digideskio / protobuf-c

Automatically exported from code.google.com/p/protobuf-c
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

enums in .proto causes build error with g++ #77

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Write a .proto file including an enum field
2. Generate .h and .c files from the .proto file
3. Write a .cc file like "Message msg = MESSAGE__INIT;"
4. Compile source files written in step 2 and 3 with g++

What is the expected output? What do you see instead?
I expect no compile errors but get:

"error: invalid conversion from 'int' to 'Message__Enum {aka _Message__Enum}' 
[-fpermissive]"

What version of the product are you using? On what operating system?
protobuf-c-0.15 on Debian GNU/Linux

Please provide any additional information below.

Original issue reported on code.google.com by akit...@gmail.com on 22 Jan 2012 at 12:05

GoogleCodeExporter commented 8 years ago
I dont get this error. I used the protobuf addressbook example proto which has 
enum defined and compiled a cpp file with

   struct  _Tutorial__Person message = TUTORIAL__PERSON__INIT;
   _Tutorial__Person__PhoneType x = TUTORIAL__PERSON__PHONE_TYPE__MOBILE;

I didnt see any compilation errors with g++. 

Original comment by dear.c...@gmail.com on 12 Oct 2012 at 4:07

GoogleCodeExporter commented 8 years ago
I also experience this issue. The error is suppressed if you are compiling with 
'-fpermissive', which is generally not a great idea to enable.

Original comment by McCann.M...@gmail.com on 21 Aug 2013 at 3:29