[LLVMbugs] [Bug 2963] New: "enumerator value is not an integer constant" error when using macros
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Mon Oct 27 22:47:17 PDT 2008
http://llvm.org/bugs/show_bug.cgi?id=2963
Summary: "enumerator value is not an integer constant" error when
using macros
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: parser
AssignedTo: unassignedbugs at nondot.org
ReportedBy: alexei.svitkine at gmail.com
CC: llvmbugs at cs.uiuc.edu
I have some code:
typedef short short_fixed;
enum
{
// 8.8 short_fixed
SHORT_FIXED_FRACTIONAL_BITS= 8,
SHORT_FIXED_ONE= 1<<SHORT_FIXED_FRACTIONAL_BITS
};
#define FLOAT_TO_SHORT_FIXED(f) ((short_fixed)((f)*SHORT_FIXED_ONE))
enum
{
SOME_VALUE= FLOAT_TO_SHORT_FIXED(0.1)
};
This code causes clang to output the following error:
error: enumerator value for 'SOME_VALUE' is not an integer constant
SOME_VALUE = FLOAT_TO_SHORT_FIXED(0.1)
However, the same code is accepted fine by both GCC and VC++ 7.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list