static_assert problem

Michał Walenciak kicer86@gmail.com
Sun Mar 18 20:34:00 GMT 2012


Hi all

here i have a simple example:

template <int a, int c>
void foo()
{
	if (a > 0)
	  static_assert(c != 0, "fdfd");
	  
}


void bar()
{  
	foo<0, 0>(); 
}


when i compile it like: g++ a.cpp -std=c++0x -c

i get:
a.cpp: In function ‘void foo() [with int a = 0, int c = 0]’:
a.cpp:13:12:   instantiated from here
a.cpp:6:4: error: static assertion failed: "fdfd"

is it right? 'a' variable is not > 0, so static_assert should not be checked 
(imho)

regards

-- 
Michał Walenciak
gmail.com kicer86
http://kicer.sileman.net.pl
gg: 3729519



More information about the Gcc-help mailing list