public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60177] New: Unable to deduce template base of derived class in function template accepting a simple-template-id
@ 2014-02-13 14:38 filip.roseen at gmail dot com
  2014-02-14 10:19 ` [Bug c++/60177] Unable to deduce template base of derived class in call to function taking a `simple-template-id` filip.roseen at gmail dot com
  2014-12-14 14:14 ` ville.voutilainen at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: filip.roseen at gmail dot com @ 2014-02-13 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60177
           Summary: Unable to deduce template base of derived class in
                    function template accepting a simple-template-id
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: filip.roseen at gmail dot com

template<class> struct Base { };

struct Derived : Base<void> { };

template<template<typename> class TT, typename T>
void func (TT<T>) { }

int main () {
  func (Derived { });
}


- - - - - - - - - - - - - - - - - - - - - - - - - -

main.cpp: In function 'int main()':
main.cpp:9:20: error: no matching function for call to 'func(Derived)'
   func (Derived { });
                    ^
main.cpp:9:20: note: candidate is:
main.cpp:6:6: note: template<template<class> class TT, class T> void
func(TT<T>)
 void func (TT<T>) { }
      ^
main.cpp:6:6: note:   template argument deduction/substitution failed:
main.cpp:9:20: note:   can't deduce a template for 'TT<T>' from non-template
type 'Derived'
   func (Derived { });

- - - - - - - - - - - - - - - - - - - - - - - - - -

gcc rejects the snippet which is a violation of [temp.deduct.call]/4 (`clang`
and `msvc` accepts the code).

`TT<T>` is a `simple-template-id` and the standard says that if a derived type
is passed to such context it should be deduced to a suitable base of that
passed type. 

Correct behavior is that the deduced template parameters for `func (Derived
{})` should be `TT = Base, T = void`.


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

end of thread, other threads:[~2014-12-14 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13 14:38 [Bug c++/60177] New: Unable to deduce template base of derived class in function template accepting a simple-template-id filip.roseen at gmail dot com
2014-02-14 10:19 ` [Bug c++/60177] Unable to deduce template base of derived class in call to function taking a `simple-template-id` filip.roseen at gmail dot com
2014-12-14 14:14 ` ville.voutilainen at gmail dot com

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