public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/52072] New: Several non-deduced context not recognized
Date: Tue, 31 Jan 2012 21:27:00 -0000	[thread overview]
Message-ID: <bug-52072-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             Bug #: 52072
           Summary: Several non-deduced context not recognized
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


gcc does not properly handle several situations where a non-deduced context
should occur. E.g. the following program is rejected:

//-------
template<class T>
struct ident { typedef T type; };

template<class T>
void f(T, typename ident<T>::type*); // Line 5

struct B {
 typedef int* type;
 operator type();
};

int main() {
 f(0, B()); // Line 13
}
//-------

"In function 'int main()':|
13|error: no matching function for call to 'f(int, B)'|
13|note: candidate is:|
 5|note: template<class T> void f(T, typename ident<T>::type*)|
 5|note:   template argument deduction/substitution failed:|
13|note:   mismatched types 'typename ident<T>::type*' and 'B'|"

It seems that the compiler only accepts situations, where the *complete* type
is wrapped like in

template<class T>
void f(T, typename ident<T*>::type);

But this behaviour does not match with the wording. According to
[temp.deduct.type] p5 b1:

"The non-deduced contexts are:
— The nested-name-specifier of a type that was specified using a qualified-id."

(The same rule exists in C++03, [temp.deduct.type] p4 b1)

The behaviour of gcc looks extraordinary when compared with other compilers,
vc10, clang, or comeau online accept the original code.


             reply	other threads:[~2012-01-31 19:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 21:27 daniel.kruegler at googlemail dot com [this message]
2012-05-22  5:33 ` [Bug c++/52072] Several non-deduced contexts " pinskia at gcc dot gnu.org
2012-05-22 18:53 ` blelbach at cct dot lsu.edu
2013-04-08 17:22 ` redi at gcc dot gnu.org
2013-04-09 12:30 ` jason at gcc dot gnu.org
2013-04-09 16:52 ` paolo.carlini at oracle dot com
2013-04-09 18:51 ` jason at gcc dot gnu.org

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=bug-52072-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).