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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to