[LLVMbugs] [Bug 9997] New: error: in-class initializer is not a constant expression

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 23 17:33:08 PDT 2011


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

           Summary: error: in-class initializer is not a constant
                    expression
           Product: clang
           Version: 2.9
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: Dave at Yost.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=6632)
 --> (http://llvm.org/bugs/attachment.cgi?id=6632)
error: in-class initializer is not a constant expression

Z% clang++ --version
Apple clang version 2.0 (tags/Apple/clang-139) (based on LLVM 2.9svn)
Target: x86_64-apple-darwin10
Thread model: posix
Z% cat clang-error-in-class-initializer-is-not-a-constant-expression.cpp

template<int v>
class foo {
public:
    static const int width;
};

template<int v> const int foo<v>::width = 1;

struct bar {
  static const int baz = foo<255>::width;
};
Z% clang++ -c clang-error-in-class-initializer-is-not-a-constant-expression.cpp
clang-error-in-class-initializer-is-not-a-constant-expression.cpp:11:26: error:
in-class initializer is not a constant
      expression
  static const int baz = foo<255>::width;
                         ^~~~~~~~~~~~~~~
1 error generated.
Z%

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