[llvm-bugs] [Bug 24541] New: Eager instantiation of constexpr variables fails if constexpr qualifier is added by static data member definition

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 21 13:31:53 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24541

            Bug ID: 24541
           Summary: Eager instantiation of constexpr variables fails if
                    constexpr qualifier is added by static data member
                    definition
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150821/20ab1e6d/attachment.html>


More information about the llvm-bugs mailing list