[Bug c++/84196] invalid call to a function template with a vector argument silently accepted
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 22 17:13:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84196
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
Known to work|4.7.4 |
Target Milestone|6.5 |---
Summary|[6/7/8 Regression] invalid |invalid call to a function
|call to a function template |template with a vector
|with a vector argument |argument silently accepted
|silently accepted |
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Which means this really is not a regression.
If you replace the v[0] + v[1] + v[2] + v[3] part that is only accepted
starting from r186994, it will be accepts-invalid all the way to the
introduction of vector_size attribute.
The clang++ error looks bogus as well, there is no reason why I can't do:
template <class T>
int f (T x)
{
T __attribute__((vector_size (16))) v = { x };
v[0] += 1;
...
return v[0];
}
int x = f (5);
What doesn't work is that 1) we don't really have mangling for template
parameter with attributes on it 2) something else is broken for parameter
passing of these, e.g.
template <class T>
int f (T v __attribute__ ((vector_size (16))))
{
return 0;
}
int main ()
{
return f<int> ((int __attribute__ ((vector_size (16)))) { 1, 2, 3, 4} );
}
where we really don't need deduction fails too and 3) deduction doesn't work
with these. So, I think we should instead reject just what we can't support
and sorry about stuff we don't want to support right now.
More information about the Gcc-bugs
mailing list