[Bug c++/97518] Improving static_assert diagnostics
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 6 19:29:02 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97518
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I have a trivial patch that improves
template<typename T>
void foo()
{
static_assert (sizeof(T) == 4);
}
void
g ()
{
foo<char>();
}
from
97518-2.C: In instantiation of ‘void foo() [with T = char]’:
97518-2.C:10:13: required from here
97518-2.C:4:28: error: static assertion failed
4 | static_assert (sizeof(T) == 4);
| ~~~~~~~~~~^~~~
to
97518-2.C: In instantiation of ‘void foo() [with T = char]’:
97518-2.C:10:13: required from here
97518-2.C:4:28: error: static assertion failed due to requirement ‘(sizeof
(char) == 4)’
4 | static_assert (sizeof(T) == 4);
| ~~~~~~~~~~^~~~
More information about the Gcc-bugs
mailing list