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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to