LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 19010 - Empty base of class with trivial default constructor is not initialized in constant expression
Summary: Empty base of class with trivial default constructor is not initialized in co...
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: C++11 (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-28 14:49 PST by Stephan Tolksdorf
Modified: 2014-03-08 06:19 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Tolksdorf 2014-02-28 14:49:35 PST
The trunk version of clang fails to compile the following test:

struct Empty {};

struct Empty2 : Empty {};

struct Test : Empty2 {
  constexpr Test() {}
};

void test() {
  constexpr Test t;	
}

> clang++ --std=c++1y test.cpp
test.cpp:10:18: error: constexpr variable 't' must be initialized by a constant expression
  constexpr Test t;
                 ^
test.cpp:10:18: note: subobject of type 'Empty' is not initialized
1 error generated.
Comment 1 Stephan Tolksdorf 2014-03-08 06:19:07 PST
Fixed in r203025.