Operating System - HP-UX
1754146 Members
3491 Online
108811 Solutions
New Discussion

Re: Odd behavior with pragmas diag_push/diag_suppress/diag_pop

 
haney
New Member

Odd behavior with pragmas diag_push/diag_suppress/diag_pop

I'm attempting to silence a warning using diag_push/diag_suppress/diag_pop, however I'm running in to some scenarios where the suppression appears to be getting ignored. The following testcase demonstrates the issue:

 

template <typename T>
struct A {
#pragma diag_push
    void func1();
#pragma diag_pop
};

 

struct B {
    void func2();

 

#pragma diag_push
#pragma diag_suppress 4285
    B& operator=(const B&) {
        func2();
        return *this;
    }
#pragma diag_pop

 

    void* data_;
};

 

void func() {
    A<int> var;
    var.func1();
}

 

When I compile this code, I see the following warning:


aCC +DD64 +w -c testcase.cpp
"testcase.cpp", line 15: remark #4285-D: operator= does not have a check for
          the source and destination addresses being non-identical
      B& operator=(const B&)
         ^

 

If I remove the extra diag_push/diag_pop around func1, or if I repeat the diag_suppress before the assignment operator, the warning is silenced, however it isn't clear to me why that would be necessary. Alternatively, Using diag_suppress/diag_default instead of diag_push/diag_suppress/diag_pop also appears to work correctly.

 

 

 

 

 

1 REPLY 1
SoumitraC
Frequent Advisor

Re: Odd behavior with pragmas diag_push/diag_suppress/diag_pop

This looks like a bug in the compiler. Can you please get in touch with the response center and file a bug report?

 

Thanks!

 

Soumitra C
HP-UX Compilers