[llvm-bugs] [Bug 47385] New: Error with consteval constructor in unevaluated sizeof context, claims constructor is undefined

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 1 07:17:15 PDT 2020


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

            Bug ID: 47385
           Summary: Error with consteval constructor in unevaluated sizeof
                    context, claims constructor is undefined
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stephan.bergmann.secondary at googlemail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

With recent Clang 12 trunk, but not with e.g. clang-10.0.0-2.fc32.x86_64:

> $ cat test.cc
> template<typename> struct S { consteval S() {} };
> int f(S<void> const &);
> int g() { return sizeof (f(S<void>())); }

> $ clang++ -std=c++20 -fsyntax-only test.cc
> test.cc:3:28: error: call to consteval function 'S<void>::S' is not a constant expression
> int g() { return sizeof (f(S<void>())); }
>                            ^
> test.cc:3:28: note: undefined constructor 'S' cannot be used in a constant expression
> test.cc:1:41: note: declared here
> template<typename> struct S { consteval S() {} };
>                                         ^
> 1 error generated.

(Issue 47350 looks similar, but no idea whether they have the same root cause.)

-- 
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/20200901/fc71b65e/attachment-0001.html>


More information about the llvm-bugs mailing list