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

Reply via email to