Comment 0 for bug 581871

Revision history for this message
luca (llucax) wrote :

I'm getting a weird error when compiling a trivial test using mq_open(), when compiling with both -pedantic and -O2:

$ cat mqtest.cpp
#include <mqueue.h>
int main()
{
        mq_open("/tmp/test", O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR, 0);
        return 0;
}
$ g++ -pedantic -O2 -c mqtest.cpp
In file included from /usr/include/mqueue.h:97,
                 from mqtest.cpp:2:
/usr/include/bits/mqueue2.h: In function ‘mqd_t mq_open(const char*, int, ...)’:
/usr/include/bits/mqueue2.h:37: error: declaration of ‘mqd_t mq_open(const char*, int, ...)’ throws different exceptions
/usr/include/bits/mqueue2.h:26: error: from previous declaration ‘mqd_t mq_open(const char*, int, ...) throw ()’

Using just -O2 or just -pedantic works fine:
$ g++ -O2 -c mqtest.cpp
$ g++ -pedantic -c mqtest.cpp
$

Using a Debian unstable system to compile, works fine with both -O2 -pedantic at the same time.

Ubuntu 10.4, x86_64, libc6-dev 2.11.1-0ubuntu7, g++ 4:4.4.3-1ubuntu1