public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115296] New: CTAD fails
@ 2024-05-30 23:25 tiagomacarios at gmail dot com
2024-05-31 17:33 ` [Bug c++/115296] " mpolacek at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: tiagomacarios at gmail dot com @ 2024-05-30 23:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115296
Bug ID: 115296
Summary: CTAD fails
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tiagomacarios at gmail dot com
Target Milestone: ---
The following code compiles fine with clang and msvc, but fails with gcc.
https://godbolt.org/z/e4dP7rzar
```
#include <span>
template <typename T>
using array_view = std::span<T>;
void fun(std::span<int> s) {
[[maybe_unused]] auto _1 = std::span{s};
[[maybe_unused]] auto _2 = array_view{s};
}
```
Error:
```
In file included from <source>:1:
/opt/compiler-explorer/gcc-trunk-20240530/include/c++/15.0.0/span: In function
'void fun(std::span<int>)':
/opt/compiler-explorer/gcc-trunk-20240530/include/c++/15.0.0/span:450:5: error:
size '18446744073709551615' of array exceeds maximum object size
'9223372036854775807'
450 | span(_Type(&)[_ArrayExtent]) -> span<_Type, _ArrayExtent>;
| ^~~~
/opt/compiler-explorer/gcc-trunk-20240530/include/c++/15.0.0/span:450:10:
error: size '18446744073709551615' of array exceeds maximum object size
'9223372036854775807'
450 | span(_Type(&)[_ArrayExtent]) -> span<_Type, _ArrayExtent>;
| ^~~~~~~~~~~~~~~~~~~~~~
<source>:8:44: error: class template argument deduction failed:
8 | [[maybe_unused]] auto _2 = array_view{s};
| ^
<source>:8:44: error: call of overloaded 'span(std::span<int>&)' is ambiguous
/opt/compiler-explorer/gcc-trunk-20240530/include/c++/15.0.0/span:464:5: note:
candidate: 'std::span(_Range&&)-> span<typename
remove_reference<ranges::range_reference_t<_Range&> >::type> requires
__is_deducible (array_view, std::span<typename
std::remove_reference<decltype(*(declval<decltype(std::ranges::__access::__begin((declval<_Container&>)()))&>)())>::type,
18446744073709551615>) [with _Range = span<int>&; typename
remove_reference<ranges::range_reference_t<_Range&> >::type = int;
ranges::range_reference_t<_Range&> = int&]'
464 | span(_Range &&)
| ^~~~
/opt/compiler-explorer/gcc-trunk-20240530/include/c++/15.0.0/span:54:11: note:
candidate: 'span(std::span<_Type, 18446744073709551615>)-> std::span<_Type,
18446744073709551615> [with T = int]'
54 | class span;
| ^~~~
/opt/compiler-explorer/gcc-trunk-20240530/include/c++/15.0.0/span:225:7: note:
candidate: 'span(const std::span<_Type, 18446744073709551615>&)->
std::span<_Type, 18446744073709551615> [with T = int]'
225 | span(const span&) noexcept = default;
| ^~~~
Compiler returned: 1
```
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/115296] CTAD fails
2024-05-30 23:25 [Bug c++/115296] New: CTAD fails tiagomacarios at gmail dot com
@ 2024-05-31 17:33 ` mpolacek at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-05-31 17:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115296
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
CC| |mpolacek at gcc dot gnu.org
Last reconfirmed| |2024-05-31
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Doesn't look like a regression.
#0 error_at (loc=74842051, gmsgid=0x38de910 "size %qE of array exceeds maximum
object size %qE")
at /home/mpolacek/src/gcc/gcc/diagnostic.cc:2137
#1 0x000000000129b72e in invalid_array_size_error (loc=74842051,
error=cst_size_too_big,
size=<integer_cst 0x7fffea203680>, name=<tree 0x0>)
at /home/mpolacek/src/gcc/gcc/c-family/c-common.cc:9212
#2 0x000000000129b8e2 in valid_array_size_p (loc=74842051, t=<integer_cst
0x7fffea203680>, name=<tree 0x0>,
complain=true) at /home/mpolacek/src/gcc/gcc/c-family/c-common.cc:9263
#3 0x0000000000ee5c74 in compute_array_index_type_loc (name_loc=74842051,
name=<tree 0x0>,
size=<integer_cst 0x7fffea203680>, complain=3) at
/home/mpolacek/src/gcc/gcc/cp/decl.cc:11653
#4 0x0000000000ee61cd in compute_array_index_type (name=<tree 0x0>,
size=<integer_cst 0x7fffea203680>,
complain=3) at /home/mpolacek/src/gcc/gcc/cp/decl.cc:11778
#5 0x000000000111fc4b in tsubst (t=<integer_type 0x7fffe941c2a0>,
args=<tree_vec 0x7fffe910c5f0>,
complain=3, in_decl=<function_decl 0x7fffe923ce00 __dguide_span>)
at /home/mpolacek/src/gcc/gcc/cp/pt.cc:16317
#6 0x00000000011217bf in tsubst (t=<array_type 0x7fffe941c348>, args=<tree_vec
0x7fffe910c5f0>, complain=3,
in_decl=<function_decl 0x7fffe923ce00 __dguide_span>) at
/home/mpolacek/src/gcc/gcc/cp/pt.cc:16742
#7 0x000000000111f4a7 in tsubst (t=<reference_type 0x7fffe941c3f0>,
args=<tree_vec 0x7fffe910c5f0>,
complain=3, in_decl=<function_decl 0x7fffe923ce00 __dguide_span>)
at /home/mpolacek/src/gcc/gcc/cp/pt.cc:16239
#8 0x000000000111d85f in tsubst_arg_types (arg_types=<tree_list
0x7fffe9799d48>,
args=<tree_vec 0x7fffe910c5f0>, end=<tree 0x0>, complain=3,
in_decl=<function_decl 0x7fffe923ce00 __dguide_span>) at
/home/mpolacek/src/gcc/gcc/cp/pt.cc:15749
#9 0x000000000111dc2d in tsubst_function_type (t=<function_type
0x7fffe941c888>,
args=<tree_vec 0x7fffe910c5f0>, complain=3, in_decl=<function_decl
0x7fffe923ce00 __dguide_span>)
at /home/mpolacek/src/gcc/gcc/cp/pt.cc:15854
#10 0x00000000011216de in tsubst (t=<function_type 0x7fffe941c888>,
args=<tree_vec 0x7fffe910c5f0>,
complain=3, in_decl=<function_decl 0x7fffe923ce00 __dguide_span>)
at /home/mpolacek/src/gcc/gcc/cp/pt.cc:16727
#11 0x0000000001112526 in tsubst_function_decl (t=<function_decl 0x7fffe923ce00
__dguide_span>,
args=<tree_vec 0x7fffe910c5f0>, complain=3, lambda_fntype=<tree 0x0>,
use_spec_table=false)
at /home/mpolacek/src/gcc/gcc/cp/pt.cc:14560
#12 0x000000000111a255 in tsubst_decl (t=<function_decl 0x7fffe923ce00
__dguide_span>,
args=<tree_vec 0x7fffe910c5f0>, complain=3, use_spec_table=false)
at /home/mpolacek/src/gcc/gcc/cp/pt.cc:15131
#13 0x0000000001165243 in alias_ctad_tweaks (tmpl=<template_decl 0x7fffe941ec00
array_view>,
uguides=<overload 0x7fffe9a571a0>) at
/home/mpolacek/src/gcc/gcc/cp/pt.cc:30380
#14 0x0000000001166b4d in deduction_guides_for (tmpl=<template_decl
0x7fffe941ec00 array_view>,
any_dguides_p=@0x7fffffffb7ef: true, complain=3) at
/home/mpolacek/src/gcc/gcc/cp/pt.cc:30714
#15 0x0000000001167a17 in do_class_deduction (ptype=<template_type_parm
0x7fffe91099d8 auto>,
tmpl=<template_decl 0x7fffe941ec00 array_view>, init=<constructor
0x7fffe910f000>,
outer_targs=<tree 0x0>, flags=1, complain=3) at
/home/mpolacek/src/gcc/gcc/cp/pt.cc:30878
#16 0x0000000001168d77 in do_auto_deduction (type=<template_type_parm
0x7fffe91099d8 auto>,
init=<constructor 0x7fffe910f000>, auto_node=<template_type_parm
0x7fffe91099d8 auto>, complain=3,
context=adc_variable_type, outer_targs=<tree 0x0>, flags=1, tmpl=<tree
0x0>)
at /home/mpolacek/src/gcc/gcc/cp/pt.cc:31089
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-31 17:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-30 23:25 [Bug c++/115296] New: CTAD fails tiagomacarios at gmail dot com
2024-05-31 17:33 ` [Bug c++/115296] " mpolacek 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).