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

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

I cannot understand why on the example:

#include <iostream>
#include <deque>

int main()
{
    constexpr auto res = []
            {
                std::deque<int> d;
                //d.push_back(42);
                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:
https://github.com/ZaMaZaN4iK/llvm-project/tree/feature/deque_constexpr

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to