public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67245] New: static_assert on inline function gives an error
@ 2015-08-17  8:25 eugene at hutorny dot in.ua
  2015-08-17  8:36 ` [Bug c++/67245] " pinskia at gcc dot gnu.org
  2015-08-17  9:05 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: eugene at hutorny dot in.ua @ 2015-08-17  8:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67245

            Bug ID: 67245
           Summary: static_assert on inline function gives an error
           Product: gcc
           Version: 4.9.2
               URL: http://stackoverflow.com/questions/32045025/static-ass
                    ert-on-inline-function-gives-error
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eugene at hutorny dot in.ua
  Target Milestone: ---

Created attachment 36193
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36193&action=edit
code snippet

Consider the following example
<code>
typedef void (*foo)();
template<foo f>
struct bar {
     static_assert(f!=nullptr,"f == null!");
};

void baz() {}
inline void bax() {  }

bar<baz> ok;
bar<bax> bad; // error: non-constant condition for static assertion
<code>

When compiled with  (g++ -std=c++14) compilation fails with 
error non-constant condition for static assertion,
blaming bax to be non-constant.

This example compiles well in clang++ 3.7 and VC++ 14.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/67245] static_assert on inline function gives an error
  2015-08-17  8:25 [Bug c++/67245] New: static_assert on inline function gives an error eugene at hutorny dot in.ua
@ 2015-08-17  8:36 ` pinskia at gcc dot gnu.org
  2015-08-17  9:05 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-08-17  8:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67245

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh looks like "weak" is getting in the way here.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/67245] static_assert on inline function gives an error
  2015-08-17  8:25 [Bug c++/67245] New: static_assert on inline function gives an error eugene at hutorny dot in.ua
  2015-08-17  8:36 ` [Bug c++/67245] " pinskia at gcc dot gnu.org
@ 2015-08-17  9:05 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2015-08-17  9:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67245

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-08-17
     Ever confirmed|0                           |1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-17  9:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-17  8:25 [Bug c++/67245] New: static_assert on inline function gives an error eugene at hutorny dot in.ua
2015-08-17  8:36 ` [Bug c++/67245] " pinskia at gcc dot gnu.org
2015-08-17  9:05 ` redi at gcc dot gnu.org

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).