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 24541 - Eager instantiation of constexpr variables fails if constexpr qualifier is added by static data member definition
Summary: Eager instantiation of constexpr variables fails if constexpr qualifier is ad...
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: C++11 (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-21 15:31 PDT by Richard Smith
Modified: 2015-08-21 15:31 PDT (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 Richard Smith 2015-08-21 15:31:53 PDT
Consider:

template < class T >
struct Foo {
  T v;
  constexpr Foo() : v(){}
  static const Foo f;
};

template < class T >
constexpr const Foo<T> Foo<T>::f = Foo();

std::array<int, Foo<std::size_t>::f.v> a;

Clang rejects this, because it doesn't eagerly instantiate Foo<size_t>::f, presumably because the constexpr specifier isn't seen until the out-of-line definition is instantiated.