public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99107] New: Ignored inconsistent parameter/arguments types in variadic templates
@ 2021-02-15 14:52 oleksandr.koval.dev at gmail dot com
0 siblings, 0 replies; only message in thread
From: oleksandr.koval.dev at gmail dot com @ 2021-02-15 14:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99107
Bug ID: 99107
Summary: Ignored inconsistent parameter/arguments types in
variadic templates
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: oleksandr.koval.dev at gmail dot com
Target Milestone: ---
template<typename... Ts>
struct Types {};
struct X {};
struct Y {};
struct Z {};
struct W {
operator Y(){return Y{};}
operator Z(){return Z{};}
};
template<typename... Ts>
void ctor(Types<Ts...>, Ts...){}
This is an error:
ctor(Types<X, Y, Z>{}, X{}, Y{}, W{});
because of mismatch during deduction: first pack is deduced to <X,Y,Z> but
second is <X,Y,W>, conversions are not allowed here.
Here we have the same mismatched types but, currently, it's OK:
ctor(Types<X, Y, Z>{}, {}, {}, W{});
I've noticed this problem while playing with CTAD for aggregates:
template<typename... Ts>
struct F : Types<Ts...>, Ts...
{};
// error, as expected
F f3 = {Types<X, Y, Z>{}, X{}, W{}};
// should also be an error
F f4 = {Types<X, Y, Z>{}, {}, W{}};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-02-15 14:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 14:52 [Bug c++/99107] New: Ignored inconsistent parameter/arguments types in variadic templates oleksandr.koval.dev at gmail dot com
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).