This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61660] static_assert triggering when it should not
- From: "us15 at os dot inf.tu-dresden.de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Jun 2014 16:56:38 +0000
- Subject: [Bug c++/61660] static_assert triggering when it should not
- Auto-submitted: auto-generated
- References: <bug-61660-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61660
--- Comment #3 from Udo Steinberg <us15 at os dot inf.tu-dresden.de> ---
Created attachment 33035
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33035&action=edit
Testcase 2
Then, similar to this new test case, I would expect something like the
following:
g++ -std=gnu++11 foo.cc -o foo
foo.cc: In function 'void check_type(unsigned int, unsigned int)':
foo.cc:10:17: error: non-constant condition for static assertion
case 0: static_assert (s == sizeof (uint16), "must use 16bit type");
break;
^
foo.cc:10:17: error: 's' is not a constant expression
If the compiler does not treat 'x' in the first test case as a constant, it
would be good to issue a warning like it does for 's' in the second test case.