public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56421] New: Non-matching overload produces template substitution error
@ 2013-02-21 20:02 kristian.spangsege at gmail dot com
  2013-02-22  9:09 ` [Bug c++/56421] " mpolacek at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: kristian.spangsege at gmail dot com @ 2013-02-21 20:02 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56421
           Summary: Non-matching overload produces template substitution
                    error
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kristian.spangsege@gmail.com


template<class S> struct Foo {
  typedef typename S::type type;
};

template<class> void foo();
template<class S> typename Foo<S>::type foo(int);

int main()
{
  foo<int>();
}


Produces the following error in both gcc-4.7.2 and gcc-4.6.3:

$ g++ -c t.cpp
t.cpp: In instantiation of ‘struct Foo<int>’:
t.cpp:6:41:   required by substitution of ‘template<class S> typename Foo::type
foo(int) [with S = int]’
t.cpp:10:12:   required from here
t.cpp:2:28: error: ‘int’ is not a class, struct, or union type


Clang accepts it as valid.


Note: No errors are reported by GCC if we change line 6 from

  template<class S> typename Foo<S>::type foo(int);

to

  template<class S> typename S::type foo(int);


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

end of thread, other threads:[~2013-02-23  1:35 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-21 20:02 [Bug c++/56421] New: Non-matching overload produces template substitution error kristian.spangsege at gmail dot com
2013-02-22  9:09 ` [Bug c++/56421] " mpolacek at gcc dot gnu.org
2013-02-22 10:42 ` redi at gcc dot gnu.org
2013-02-22 10:59 ` daniel.kruegler at googlemail dot com
2013-02-22 16:25 ` redi at gcc dot gnu.org
2013-02-22 18:05 ` kristian.spangsege at gmail dot com
2013-02-22 18:48 ` redi at gcc dot gnu.org
2013-02-22 22:01 ` daniel.kruegler at googlemail dot com
2013-02-22 22:17 ` redi at gcc dot gnu.org
2013-02-22 23:10 ` kristian.spangsege at gmail dot com
2013-02-22 23:11 ` kristian.spangsege at gmail dot com
2013-02-22 23:20 ` redi at gcc dot gnu.org
2013-02-22 23:39 ` kristian.spangsege at gmail dot com
2013-02-22 23:46 ` kristian.spangsege at gmail dot com
2013-02-23  0:03 ` kristian.spangsege at gmail dot com
2013-02-23  0:29 ` redi at gcc dot gnu.org
2013-02-23  0:31 ` redi at gcc dot gnu.org
2013-02-23  1:35 ` kristian.spangsege 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).