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: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Jun 2014 17:21:36 +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 #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Udo Steinberg from comment #3)
> Created attachment 33035 [details]
> 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.
That is still correct s is not a constant expression.