public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: nathan@codesourcery.com To: gcc-gnats@gcc.gnu.org Subject: c++/1617: partial ordering of function templates Date: Sun, 01 Apr 2001 00:00:00 -0000 [thread overview] Message-ID: <20010111132238.30653.qmail@sourceware.cygnus.com> (raw) >Number: 1617 >Category: c++ >Synopsis: partial ordering of function templates >Confidential: no >Severity: serious >Priority: high >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Thu Jan 11 05:26:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Nathan >Release: cvs 20010111 >Organization: >Environment: >Description: current/deduce.ii:6: call of overloaded `Foo(int*&)' is ambiguous current/deduce.ii:1: candidates are: void Foo(T*) [with T = int] current/deduce.ii:2: void Foo(T&) [with T = int*] but I think the first choice is more specialized than the second. 14.5.5.2 tells us to take each choice in turn, synthesize a unique type for each template type parameter into the function's parameter list and then try type deduction using the other choice. The transformed template is at least as specialized as the other if deduction succeeds and the deduced parameter types are an exact match. In this case that gives us, with a unique type called 'X' a: Foo (T *) -> Foo (X *), using Foo (T &) deduce T to be X *, deduction succeeds. b: Foo (T &) -> Foo (X &), using Foo (T *) deduction fails so b is less specialized than a, and void Foo(T*) [with T = int] should be selected see http://gcc.gnu.org/ml/gcc-bugs/2001-01/msg00233.html >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="spec.ii" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="spec.ii" dGVtcGxhdGUgPHR5cGVuYW1lIFQ+IHZvaWQgRm9vIChUICopOwp0ZW1wbGF0ZSA8dHlwZW5hbWUg VD4gdm9pZCBGb28gKFQgJik7Cgp2b2lkIEJheiAoaW50ICpwdHIpCnsKICBGb28gKHB0cik7Cn0K >From leo.dearden@acm.org Sun Apr 01 00:00:00 2001 From: leo.dearden@acm.org To: gcc-gnats@gcc.gnu.org Subject: c++/2215: ICE on compilation of code with -fhonor-std and -ggdb Date: Sun, 01 Apr 2001 00:00:00 -0000 Message-id: <20010307220108.4346.qmail@sourceware.cygnus.com> X-SW-Source: 2001-q1/msg02094.html Content-length: 6778 >Number: 2215 >Category: c++ >Synopsis: ICE on compilation of code with -fhonor-std and -ggdb >Confidential: no >Severity: serious >Priority: low >Responsible: unassigned >State: open >Class: ice-on-illegal-code >Submitter-Id: net >Arrival-Date: Wed Mar 07 14:06:02 PST 2001 >Closed-Date: >Last-Modified: >Originator: Leo Dearden (leo.dearden@acm.org) >Release: 2.95.3 20010219 (prerelease) >Organization: >Environment: debian unsable (woody) current 7/3/01, ALSA and NVdriver additional kernel modules, default environment setteings, IA-32 (intel celeron, i440BX chipset, 256MB RAM, UDMA (IDE) HD) >Description: the code is incorrect, in that ALSAExeption.h:9: should read ALSAException: public std::exception but reads: ALSAException: public exception hence the parse errors. However with -ggdb or -ggdb3 the attempt to compile causes an ICE. -ggdb1 or any -g[1,2,3] don't cause the ICE. When I avoid the ICE by adding "std::" I get output code that I think is incorect, but that's in another bug report. ld225@ld225:~/avm/main$ s In file included from ALSAException.cpp:4: ALSAException.h:10: parse error before `{' ALSAException.h:14: parse error before `const' ALSAException.h:15: destructors must be member functions ALSAException.h:15: virtual outside class declaration ALSAException.h:16: virtual outside class declaration ALSAException.h:16: non-member function `what()' cannot have `const' method qualifier ALSAException.h:17: virtual outside class declaration ALSAException.h:17: non-member function `getErrorNumber()' cannot have `const' method qualifier ALSAException.h:18: virtual outside class declaration ALSAException.h:18: non-member function `getCall()' cannot have `const' method qualifier ALSAException.h:20: parse error before `private' ALSAException.h:27: parse error before `}' ALSAException.cpp:10: invalid use of undefined type `class ALSAException' ALSAException.h:9: forward declaration of `class ALSAException' ALSAException.cpp: In method `ALSAException::ALSAException(int, const char *)': ALSAException.cpp:12: class `ALSAException' does not have any field named `call' ALSAException.cpp:13: class `ALSAException' does not have any field named `errorNumber' ALSAException.cpp:15: class `ALSAException' does not have any field named `errorNumberText' ALSAException.cpp:16: class `ALSAException' does not have any field named `errorNameText' ALSAException.cpp:18: `call' undeclared (first use this function) ALSAException.cpp:18: (Each undeclared identifier is reported only once ALSAException.cpp:18: for each function it appears in.) ALSAException.cpp:21: Internal compiler error in `scope_die_for', at dwarf2out.c:7804 Please submit a full bug report. >How-To-Repeat: // to get ICE: // g++ -fhonor-std -ggdb -c -o ALSAException.o ALSAException.cpp // I can't get mozilla to attach more than one file, so // here is the other part of the problem. #ifndef AVM_ALSA_EXCEPTION_H #define AVM_ALSA_EXCEPTION_H #include <exception> class ALSAException : public exception { public: // ALSAException(char const * const call = "call unspecified."); ALSAException(int newErrorNumber, char const * newCall = "call unspecified"); ALSAException(ALSAException const &); virtual ~ALSAException(); virtual char const * what() const; virtual int getErrorNumber() const; virtual char const * getCall() const; private: char* call; // bool const errorNumberValid; int errorNumber; char* errorNumberText; char* errorNameText; }; #endif //AVM_ALSA_EXCEPTION_H >Fix: don't use -ggdb or -ggdb3 with -fhonor-std and lack of scope resolution. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/cpp; name="ALSAException.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ALSAException.cpp" Ly8gYmFzZSBjbGFzcyBmb3IgYWxsIGV4Y2VwdGlvbnMKLy8gd3JpdHRlbiAzLzMvMDEgYnkgTGVv IERlYXJkZW4KCiNpbmNsdWRlICJBTFNBRXhjZXB0aW9uLmgiCiNpbmNsdWRlIDxzeXMvYXNvdW5k bGliLmg+Ci8vI2luY2x1ZGUgPGNzdHJpbmc+CiNpbmNsdWRlIDxjc3RkaW8+CgovLyBjYWxsID0g bmFtZSBvZiBjYWxsIHdoaWNoIGZhaWxlZApBTFNBRXhjZXB0aW9uOjpBTFNBRXhjZXB0aW9uKGlu dCBuZXdFcnJvck51bWJlciwgY2hhciBjb25zdCAqIG5ld0NhbGwpOgogIC8vIGNyZWF0ZSBhIG5l dyBjaGFyW10gYmlnIGVub3VnaCB0byBob2xkIG5ld0NhbGwKICBjYW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W1iZXJUZXh0LCAiOiAiLCAoY2hhciAqKSBlcnJvck5hbWVUZXh0KTsgCiAgcmV0dXJuIHJldHVy blN0cmluZzsKfQoKaW50IEFMU0FFeGNlcHRpb246OmdldEVycm9yTnVtYmVyKCkgY29uc3QKewog IHJldHVybiBlcnJvck51bWJlcjsKfQoKY2hhciBjb25zdCAqIEFMU0FFeGNlcHRpb246OmdldENh bGwoKSBjb25zdAp7CiAgcmV0dXJuIGNhbGw7Cn0KCgoK
next reply other threads:[~2001-04-01 0:00 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-04-01 0:00 nathan [this message] 2001-04-01 0:00 Gabriel Dos Reis 2001-04-01 0:00 Martin Sebor 2001-04-01 0:00 Nathan Sidwell
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20010111132238.30653.qmail@sourceware.cygnus.com \ --to=nathan@codesourcery.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).