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

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