[LLVMbugs] [Bug 6384] New: initialized if it is a static const integral data member

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 22 03:46:51 PST 2010


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

           Summary: initialized if it is a static const integral data
                    member
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rene at exactcode.de
                CC: dgregor at apple.com
   Estimated Hours: 0.0


Getting another piece of production code to compile the next error is:

test.cc:5:26: error: in-class initializer has non-integral, non-enumeration
type 'double'

While the type is a double in this case. This is tested in the clang testsuite:

test/SemaTemplate/instantiate-static-var.cpp

template<typename T>
class Y {
 static const T value = 0; // expected-error{{'value' can only be initialized
if it is a static const integral data member}}
};

Y<float> fy; // expected-note{{in instantiation of template class 'class
Y<float>' requested here}}

G++, even including the latest 4.4, does not even warn about this on neither
-Wall, nor -Wextra, only with -pedantic. I assume due to this other POD
initialization, especially of FP types will occur in quite some shipping code
and thus suggest making it a warning by default, likewise.

-- 
Configure bugmail: http://www.llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the llvm-bugs mailing list