public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55809] New: Doesn't differentiate elaborated type specifier and typename specifier in dependent types
@ 2012-12-26  1:48 schaub.johannes at googlemail dot com
  2021-12-08  8:51 ` [Bug c++/55809] g++ doesn't " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: schaub.johannes at googlemail dot com @ 2012-12-26  1:48 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55809
           Summary: Doesn't differentiate elaborated type specifier and
                    typename specifier in dependent types
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: schaub.johannes@googlemail.com


The following looks well-formed

template<typename T, typename T::X *> void f() { } 
template<typename T, class T::X *> void f() { } 

struct A { typedef int X; }; 
struct B { void X(); class X { }; }; 

class B::X x1; 
int x2; 

int main() { f<A, &x2>(); f<B, &x1>(); }

But GCC shouts:

  prog.cpp:1:94: error: redefinition of 'template<class T, class T::X*
<anonymous> > void f()'
  prog.cpp:1:46: error: 'template<class T, typename T::X* <anonymous> > void
f()' previously declared here

Related Bugreport (responsible for accepting the above testcase too, when it's
fixed): http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48920 . 

Clang accepts the above code, so my statement in PR48920 that the Itanium ABI
does not allow to distiguish between the different signatures appears to be
wrong and GCC should support this code.


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

* [Bug c++/55809] g++ doesn't differentiate elaborated type specifier and typename specifier in dependent types
  2012-12-26  1:48 [Bug c++/55809] New: Doesn't differentiate elaborated type specifier and typename specifier in dependent types schaub.johannes at googlemail dot com
@ 2021-12-08  8:51 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-08  8:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55809

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
MSVC gives:
<source>(3): error C2995: 'void f(void)': function template has already been
defined
<source>(2): note: see declaration of 'f'
<source>(2): error C3861: 'f': identifier not found

ICC gives:

<source>(11): error: more than one instance of overloaded function "f" matches
the argument list:
            function template "void f<T,<unnamed>>()"
            function template "void f<T,<unnamed>>()"
  int main() { f<A, &x2>(); f<B, &x1>(); }
               ^

clang accepts it.

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

end of thread, other threads:[~2021-12-08  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-26  1:48 [Bug c++/55809] New: Doesn't differentiate elaborated type specifier and typename specifier in dependent types schaub.johannes at googlemail dot com
2021-12-08  8:51 ` [Bug c++/55809] g++ doesn't " pinskia 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).