[Bug c++/18933] New: pointer-to-member called on incomplete type generates bad code

2004-12-10 Thread efrias at syncad dot com
When presented with the attached code, gcc (taken from CVS on Dec. 6 2004)
generates bad code for the function callpmf().  The code it generates never
calls the member function, so the exit status of this program is garbage (I get
39).  No diagnostic is issued when compiling.

If you replace the declaration of A with a trivial definition ("class A{};"), it
generates the correct code.

gcc-3.4.2 and earlier generated the correct code regardless of whether A was an
incomplete type.  


class A;

class B {
public:
int memfn() { return 1; }
};

int callpmf(A* a_ptr, int (A::*memfn_ptr)()) {
return (a_ptr->*memfn_ptr)();
}

int main() {
B b;
return callpmf((A*)&b, (int (A::*)())&B::memfn);
}

This bug looks related to 15684, which seems to be debating whether this is a
legal thing to do or not.  If it is decided that this is illegal, a diagnostic
would be helpful.

-- 
   Summary: pointer-to-member called on incomplete type generates
bad code
   Product: gcc
   Version: 4.0.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: efrias at syncad dot com
CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18933


[Bug c++/17470] Visibility attribute ignored for explicit template instantiation

2004-12-13 Thread efrias at syncad dot com

--- Additional Comments From efrias at syncad dot com  2004-12-13 20:46 
---
I just ran into this quirk too.  It looks like you can work around by using
"#pragma GCC visibility push(default)" before the explicit instantiation and
then popping afterwards.  I'd greatly prefer the __attribute__ syntax because
that would permit me to use one macro for porting __declspec(dllexport)
constructs from windows code.  Even displaying a warning or error for the
ignored __attribute__ would've saved me some grief.

-- 
   What|Removed |Added

 CC|            |efrias at syncad dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17470