[llvm-bugs] [Bug 51406] New: Constraint normalization of a parenthesized atomic constraint yields a different expression than an identical non-parenthesized atomic constraint
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Aug 7 18:13:46 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51406
Bug ID: 51406
Summary: Constraint normalization of a parenthesized atomic
constraint yields a different expression than an
identical non-parenthesized atomic constraint
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: matthewjbarichello at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Affected versions:
- trunk
- 12.0.1
- 12.0.0
- 11.0.1
- 11.0.0
- 10.0.1
- 10.0.0
- 9.0.1
- 9.0.0
Driver cmdline:
Note: For versions not supporting -std=c++20, -std=c++2a was used.
clang++ -std=c++20 -Werror -Wall -pedantic
Code:
template<typename>
concept B = true;
template<typename T>
requires (B<T>)
struct A;
template<typename T>
requires B<T>
struct A {};
Error:
<source>:9:10: error: requires clause differs in template redeclaration
requires B<T>
^
<source>:5:10: note: previous template declaration is here
requires (B<T>)
^
1 error generated.
Notice that in the example the forward declaration of the template `A<T>` has a
requires clause with a parenthesized atomic constraint, `(B<T>)`, whereas the
definition of `A<T>` has the same requires clause, albeit non-parenthesized.
After constraint normalization, both requires clauses should be equivalent,
however, clang yields an error.
Notes:
- GCC does not exhibit this issue.
- MSVC has a similar issue that seems to be, incorrectly, fixed by converting
the redeclaration of `A` into a partially specialized template.
--
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/20210808/134f0077/attachment.html>
More information about the llvm-bugs
mailing list