[LLVMbugs] [Bug 11157] New: constexpr constructors can't initialize constexpr variables

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 17 12:34:46 PDT 2011


           Summary: constexpr constructors can't initialize constexpr
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: max at duempel.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

Created an attachment (id=7471)
 --> (http://llvm.org/bugs/attachment.cgi?id=7471)
demo source code

With the attached source file, I get the following error message:

clang++ -std=c++11 -c constexpr.cc 
constexpr.cc:7:13: error: constexpr variable 'a' must be initialized by a
constant expression
constexpr X a(2);
1 error generated.

The second variable "b" which calls the default constructor gets initialized
correctly, but the "constexpr" constructor cannot be called to initialize the
variable "a".

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