public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52072] New: Several non-deduced context not recognized
@ 2012-01-31 21:27 daniel.kruegler at googlemail dot com
  2012-05-22  5:33 ` [Bug c++/52072] Several non-deduced contexts " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-01-31 21:27 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52072] Several non-deduced contexts not recognized
  2012-01-31 21:27 [Bug c++/52072] New: Several non-deduced context not recognized daniel.kruegler at googlemail dot com
@ 2012-05-22  5:33 ` pinskia at gcc dot gnu.org
  2012-05-22 18:53 ` blelbach at cct dot lsu.edu
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-05-22  5:33 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-05-22
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-22 05:24:32 UTC ---
Confirmed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52072] Several non-deduced contexts not recognized
  2012-01-31 21:27 [Bug c++/52072] New: Several non-deduced context not recognized daniel.kruegler at googlemail dot com
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: blelbach at cct dot lsu.edu @ 2012-05-22 18:53 UTC (permalink / raw)
  To: gcc-bugs

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

Bryce Lelbach (wash) <blelbach at cct dot lsu.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |blelbach at cct dot lsu.edu

--- Comment #2 from Bryce Lelbach (wash) <blelbach at cct dot lsu.edu> 2012-05-22 18:36:11 UTC ---
*** Bug 53446 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52072] Several non-deduced contexts not recognized
  2012-01-31 21:27 [Bug c++/52072] New: Several non-deduced context not recognized daniel.kruegler at googlemail dot com
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2013-04-08 17:22 UTC (permalink / raw)
  To: gcc-bugs


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |redi at gcc dot gnu.org

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-04-08 17:22:29 UTC ---
*** Bug 56874 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52072] Several non-deduced contexts not recognized
  2012-01-31 21:27 [Bug c++/52072] New: Several non-deduced context not recognized daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2013-04-09 12:30 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2013-04-09 12:30:15 UTC ---
The rule G++ is getting wrong is in 14.8.1:

Implicit conversions (Clause 4) will be performed on a function argument to
convert it to the type of the corresponding function parameter if the parameter
type contains no template-parameters that participate in template argument
deduction.

And there's a FIXME to this effect in unify_one_argument:

  /* FIXME uses_deducible_template_parms */
  if (TYPE_P (parm) && !uses_template_parms (parm))
    return check_non_deducible_conversion (parm, arg, strict, flags,
                                           explain_p);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52072] Several non-deduced contexts not recognized
  2012-01-31 21:27 [Bug c++/52072] New: Several non-deduced context not recognized daniel.kruegler at googlemail dot com
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-04-09 16:52 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-09 16:52:07 UTC ---
I suppose PR23055 is another Dup?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52072] Several non-deduced contexts not recognized
  2012-01-31 21:27 [Bug c++/52072] New: Several non-deduced context not recognized daniel.kruegler at googlemail dot com
                   ` (4 preceding siblings ...)
  2013-04-09 16:52 ` paolo.carlini at oracle dot com
@ 2013-04-09 18:51 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2013-04-09 18:51 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2013-04-09 18:51:23 UTC ---
Yes.

*** This bug has been marked as a duplicate of bug 23055 ***


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-04-09 18:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-31 21:27 [Bug c++/52072] New: Several non-deduced context not recognized daniel.kruegler at googlemail dot com
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

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).