[llvm-bugs] [Bug 45770] New: Clang frontend failed on parsing concept with packed parameters

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 1 10:34:26 PDT 2020


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

            Bug ID: 45770
           Summary: Clang frontend failed on parsing concept with packed
                    parameters
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: luohaothu at live.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 23431
  --> https://bugs.llvm.org/attachment.cgi?id=23431&action=edit
Clang generated bug description files

Clang frontend failed on parsing following minimized case:

template <typename T, typename U>
concept C1 = false;

template <typename T, typename ... Args>
concept C2 = sizeof...(Args) == 1 && C1<T, Args>;

template <typename T> requires C2<T, int>
void f(T t) {}

int main() {
        f(1);
        return 0;
}

Steps to Reproduce:

Compile this snippet with command:

clang++-10 -std=c++20 main.cpp -o main

will cause the frontend to crash.

Expected Results:
It's obvious to find that code line `concept C2 = sizeof...(Args) == 1 && C1<T,
Args>;` doesn't correctly unpacked the parameter pack, which should be
corrected to:
concept C2 = sizeof...(Args) == 1 && (... && C1<T, Args>);
which will then compile correctly. It seems that the frontend has some defects
preventing itself from handling such syntax error.

Additional Information:
The environment tested is WSL1 on Windows 10 2004 with Ubuntu-18.04, and the
clang version is 10.0.0-++20200412073436+50d7e5d5e7d-1~exp1~20200412054917.132.
I've also tested on the Compiler Explorer website with clang 10 & clang (trunk)
which all give the same result. G++ (trunk) can handle the error correctly.

-- 
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/20200501/81fbd931/attachment.html>


More information about the llvm-bugs mailing list