public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94597] New: ICE while using a concept checking for user defined conversion operator
@ 2020-04-14 17:38 barolek at gmail dot com
2020-04-15 5:31 ` [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891 marxin at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: barolek at gmail dot com @ 2020-04-14 17:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94597
Bug ID: 94597
Summary: ICE while using a concept checking for user defined
conversion operator
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barolek at gmail dot com
Target Milestone: ---
Hello,
I found this ICE when playing with Godbolt compiler explorer. I don't have
access to system with installed GCC, I can't get preprocessed file (as in
instruction), I will give the source code, that caused the error.
Following snipped caused ICE on GCC, it compiles with Clang, I think (concepts
are new feature and I'm not expert) that this is a valid code which should
accept types with defined user defined conversion operator.
GCC INFO:
COLLECT_GCC=/opt/compiler-explorer/gcc-snapshot/bin/g++
Target: x86_64-linux-gnu
Configured with: ../gcc-trunk-20200414/configure
--prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap
--enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --enable-clocale=gnu --enable-languages=c,c++,fortran,ada,d
--enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto
--enable-plugins --enable-threads=posix
--with-pkgversion=Compiler-Explorer-Build
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.1 20200413 (experimental) (Compiler-Explorer-Build)
COMPILER FLAGS: -std=c++2a
SOURCE CODE: (https://godbolt.org/z/33LD8M) (It compiles with clang trunk with
-stdlib=libc++ flag)
#include <concepts>
template<typename From, typename To>
concept has_user_defined_conversion = requires (From f)
{
f.operator To();
};
template<typename w, typename w2>
requires (has_user_defined_conversion<w, w2>)
bool equal(w const& x, w2 const& y)
{
return x == y;
}
template <typename T>
struct wrapper
{
T f;
wrapper(T a) : f(a) {}
operator T() const
{
return f;
}
};
bool fun()
{
wrapper a(2.0f);
wrapper b(3.0f);
return equal(a, 3.0f);
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891
2020-04-14 17:38 [Bug c++/94597] New: ICE while using a concept checking for user defined conversion operator barolek at gmail dot com
@ 2020-04-15 5:31 ` marxin at gcc dot gnu.org
2020-04-17 12:55 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-15 5:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94597
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.0
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Keywords| |ice-on-valid-code
Ever confirmed|0 |1
Summary|ICE while using a concept |[10 Regression] ICE while
|checking for user defined |using a concept checking
|conversion operator |for user defined conversion
| |operator since
| |r10-3735-gcb57504a55015891
Known to work| |9.3.0
Target Milestone|--- |10.0
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-04-15
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r10-3735-gcb57504a55015891.
Reduced test-case:
$ cat pr94597.ii
template <typename b, typename c> concept d = requires(b e) { e.operator c; };
template <typename f, typename g> requires(d<f, g>) bool equal(f, g);
template <typename h> struct i {
i(h);
operator h();
};
bool fun() {
i a(2.0f);
return equal(a, 3.0f);
}
$ g++ -std=c++2a -fconcepts pr94597.ii -c
pr94597.ii: In instantiation of ‘bool equal(f, g) [with f = i<float>; g =
float]’:
pr94597.ii:9:23: required from here
pr94597.ii:1:74: internal compiler error: tree check: accessed elt 2 of
‘tree_vec’ with 1 elts in tsubst, at cp/pt.c:15175
1 | template <typename b, typename c> concept d = requires(b e) {
e.operator c; };
|
~~~~~~~~~~~^
0x84239d tree_vec_elt_check_failed(int, int, char const*, int, char const*)
/home/marxin/Programming/gcc/gcc/tree.c:9928
0x6a6a8b tree_vec_elt_check(tree_node*, int, char const*, int, char const*)
/home/marxin/Programming/gcc/gcc/tree.h:3508
0x6a6a8b tsubst(tree_node*, tree_node*, int, tree_node*)
/home/marxin/Programming/gcc/gcc/cp/pt.c:15175
0xab6c3b tsubst_copy
/home/marxin/Programming/gcc/gcc/cp/pt.c:16821
0xabd7e4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:20125
0xab0677 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:18690
0x982f25 tsubst_valid_expression_requirement
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:1867
0x982f25 tsubst_simple_requirement
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:1880
0x982f25 tsubst_requirement
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:2032
0x982f25 tsubst_requirement_body
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:2054
0x982f25 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:2170
0xabd8da tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:20440
0xab0677 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:18690
0x9829d8 satisfy_atom
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:2595
0x9829d8 satisfy_constraint_r
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:2657
0x982dd8 satisfy_constraint
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:2677
0x983f42 satisfy_declaration_constraints
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:2776
0x983f42 constraint_satisfaction_value
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:2812
0x9843fa constraints_satisfied_p(tree_node*)
/home/marxin/Programming/gcc/gcc/cp/constraint.cc:2846
0x933368 add_function_candidate
/home/marxin/Programming/gcc/gcc/cp/call.c:2288
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ g++-9 -std=c++2a -fconcepts pr94597.ii -c
[ok]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891
2020-04-14 17:38 [Bug c++/94597] New: ICE while using a concept checking for user defined conversion operator barolek at gmail dot com
2020-04-15 5:31 ` [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891 marxin at gcc dot gnu.org
@ 2020-04-17 12:55 ` jakub at gcc dot gnu.org
2020-04-21 12:55 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-17 12:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94597
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
Priority|P3 |P1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891
2020-04-14 17:38 [Bug c++/94597] New: ICE while using a concept checking for user defined conversion operator barolek at gmail dot com
2020-04-15 5:31 ` [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891 marxin at gcc dot gnu.org
2020-04-17 12:55 ` jakub at gcc dot gnu.org
@ 2020-04-21 12:55 ` ppalka at gcc dot gnu.org
2020-04-21 15:00 ` cvs-commit at gcc dot gnu.org
2020-04-21 15:05 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-04-21 12:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94597
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
CC| |ppalka at gcc dot gnu.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891
2020-04-14 17:38 [Bug c++/94597] New: ICE while using a concept checking for user defined conversion operator barolek at gmail dot com
` (2 preceding siblings ...)
2020-04-21 12:55 ` ppalka at gcc dot gnu.org
@ 2020-04-21 15:00 ` cvs-commit at gcc dot gnu.org
2020-04-21 15:05 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-21 15:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94597
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:08d6ec14e654292340ccc6aa5612bbd91d4d57e8
commit r10-7848-g08d6ec14e654292340ccc6aa5612bbd91d4d57e8
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Apr 21 10:56:57 2020 -0400
c++: Dependent conversion operator in concept [PR94597]
When building the parameter mapping for an atomic constraint,
find_template_parameters does not spot the template parameter within the
conversion-type-id of a dependent conversion operator, which later leads to
an
ICE during substitution when looking up the missing template argument for
this
unnoticed template parameter.
gcc/cp/ChangeLog:
PR c++/94597
* pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If
this
is a conversion operator, visit its TREE_TYPE.
gcc/testsuite/ChangeLog:
PR c++/94597
* g++.dg/cpp2a/concepts-conv2.C: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891
2020-04-14 17:38 [Bug c++/94597] New: ICE while using a concept checking for user defined conversion operator barolek at gmail dot com
` (3 preceding siblings ...)
2020-04-21 15:00 ` cvs-commit at gcc dot gnu.org
@ 2020-04-21 15:05 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-04-21 15:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94597
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.
I think the reduced testcase in #c1 is invalid as-is -- the requirement
"e.operator c;" should be "e.operator c();", because according to [expr.ref]:
[The expression E1.E2 where E2 refers to a non-static member function] can
be used only as the left-hand operand of a member function call.
I committed the reduced testcase with that change.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-04-21 15:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 17:38 [Bug c++/94597] New: ICE while using a concept checking for user defined conversion operator barolek at gmail dot com
2020-04-15 5:31 ` [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891 marxin at gcc dot gnu.org
2020-04-17 12:55 ` jakub at gcc dot gnu.org
2020-04-21 12:55 ` ppalka at gcc dot gnu.org
2020-04-21 15:00 ` cvs-commit at gcc dot gnu.org
2020-04-21 15:05 ` ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).