[LLVMbugs] [Bug 12170] New: anonymous union can not be defined in a type specifier

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 2 18:13:37 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=12170

             Bug #: 12170
           Summary: anonymous union can not be defined in a type specifier
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: maillist-llvm at barfooze.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


# g++ -std=gnu++98 ../test.cc
# 
# clang++ -std=gnu++98 ../test.cc 
In file included from ../test.cc:3:
../test.h:13:21: error: 'FUX::IX::<anonymous union at ../test.h:13:21>' can not
be defined in a type specifier
                        return weight != HUGE_VALF;
                                         ^
../test.h:5:19: note: expanded from macro 'HUGE_VALF'
#define HUGE_VALF __MAKE_FLOAT(0x7800000)
                  ^
../test.h:4:28: note: expanded from macro '__MAKE_FLOAT'
#define __MAKE_FLOAT(i) (((union { int __i; float __f; }){ i }).__f)
                           ^
1 error generated.



#define __MAKE_FLOAT(i) (((union { int __i; float __f; }){ i }).__f)
#define HUGE_VALF __MAKE_FLOAT(0x7800000)

namespace FUX {
class IX {
        private:
                float weight;
        public:
                bool isSpillable() const {
                        return weight != HUGE_VALF;
                }
};

};
----------------------
#include <stdio.h>

#include "test.h"

using namespace FUX;

int main() { 
        IX x;
        printf("%d\n", x.isSpillable());
}

-- 
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