[llvm-bugs] [Bug 43674] New: Constexpr new: strange behavior and lack of diagnostic information

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 15 02:04:12 PDT 2019


            Bug ID: 43674
           Summary: Constexpr new: strange behavior and lack of diagnostic
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zamazan4ik at tut.by
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

I cannot understand why on the example:

#include <iostream>
#include <deque>

int main()
    constexpr auto res = []
                std::deque<int> d;
                return d.size();
    std::cout << res << std::endl;
    return 0;

I get the error:

/home/zamazan4ik/OpenSource/test_llvm_lib/main.cpp:6:20: error: constexpr
variable 'res' must be initialized by a constant expression
    constexpr auto res = []
                   ^     ~~

without any additional information what is going wrong.
But if you uncomment line with push_back - all will be fine. I cannot
understand, what is wrong here.

My try for constexpr deque you can find here:

Preprocessed file: https://gofile.io/?c=VOmzKT

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/20191015/ae4f8a75/attachment.html>

More information about the llvm-bugs mailing list