This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/7224: g++ 3.x does not tecognize unused ambiguous inline member functions


>Number:         7224
>Category:       c++
>Synopsis:       g++ 3.x does not tecognize unused ambiguous inline member functions
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 06 11:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Aaron Isotton
>Release:        gcc version 3.1.1 20020606 (Debian prerelease)
>Organization:
>Environment:
i686 Linux 2.5.25
>Description:
The following code compiles:

struct foo
{
    void bar() {}
    int bar() {return 0;}
};

int main() {}

It should generate an error as two functions differing only in their return value are not permitted.

If the functions are not declared inline (i.e. outside the class) the assembler complains because the two functions have the same name; if the functions are used, a proper error message is emitted.

The same happens with g++ 3.0; g++ 2.95 recognizes the problem and emits an error message.
>How-To-Repeat:
Compile this snippet with no compiler flags:


struct foo
{
    void bar() {
    }

    int bar() {
        return 0;
    }
};

int main() {}

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]