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

             Bug #: 11614
           Summary: Cannot assign in constexpr initialization
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


struct Foo {};constexpr Foo foo = Foo();

constexpr.cc:1:29: error: constexpr variable 'foo' must be initialized by a
constant expression

The assignment should be allowed, because the value of Foo() is known at
compile time (it doesn't make a difference if I make the struct non-empty and
add an explicit constexpr constructor, by the way).

The following works:

struct Foo {};constexpr Foo foo();

This problem occurs with libstdc++ 4.6 in allocator.h:

  struct allocator_arg_t { };
  constexpr allocator_arg_t allocator_arg = allocator_arg_t();

svn trunk 146862

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