public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23227] New: SFINAE bug
@ 2005-08-04  9:30 sylvain dot pion at sophia dot inria dot fr
  2005-08-04 13:07 ` [Bug c++/23227] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: sylvain dot pion at sophia dot inria dot fr @ 2005-08-04  9:30 UTC (permalink / raw)
  To: gcc-bugs

The following code refuses to compile :
----------------------------
struct C;

template < typename T >
struct B;

template < typename T >
struct A;

void f(const C &c);    // this one is fine
void f(const B<C> &a); // this one is fine
void f(const A<C> &a); // this one triggers the bug
void f(double) {}

template < typename T >
struct A
{
  B<T> b;
};


int main()
{
  f(1.0); // => instantiates A<C> => instantiates B<C> => fails.
}
-------------------------------

The error message is :
instance.C: In instantiation of 'A<C>':
instance.C:23:   instantiated from here
instance.C:17: error: 'A<T>::b' has incomplete type
instance.C:4: error: declaration of 'struct B<C>'

I am not 100% sure it is a SFINAE bug, but it looks like one to me.

Note that if you comment the declaration of f(A<C>), then it works.
Similarly if you comment the definition of A.

So the problem here is probably that if the definition of A is
available, then the compiler instantiates it, which triggers the
instantiation of B<T>, which fails, but the compiler does not
recover from this instantiation as it should (following SFINAE).

There is the same problem with g++ 3.3, 3.4 and 4.0.1.

-- 
           Summary: SFINAE bug
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sylvain dot pion at sophia dot inria dot fr
                CC: gcc-bugs at gcc dot gnu dot org,sylvain dot pion at
                    sophia dot inria dot fr
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <bug-23227-1902@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2009-03-04  1:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-04  9:30 [Bug c++/23227] New: SFINAE bug sylvain dot pion at sophia dot inria dot fr
2005-08-04 13:07 ` [Bug c++/23227] " pinskia at gcc dot gnu dot org
2005-08-04 13:27 ` gdr at integrable-solutions dot net
2005-08-05  4:02 ` pinskia at gcc dot gnu dot org
2005-09-14 15:35 ` bangerth at dealii dot org
2005-09-14 21:03 ` gdr at integrable-solutions dot net
2005-09-14 21:11 ` bangerth at dealii dot org
2005-09-14 21:23 ` pinskia at gcc dot gnu dot org
2005-09-14 22:11 ` gdr at integrable-solutions dot net
2005-09-18 19:43 ` fang at csl dot cornell dot edu
     [not found] <bug-23227-1902@http.gcc.gnu.org/bugzilla/>
2009-02-22 16:29 ` steven at gcc dot gnu dot org
2009-02-22 16:39 ` paolo dot carlini at oracle dot com
2009-03-04  1:28 ` jason at gcc dot gnu dot org
2009-03-04  1:29 ` jason at gcc dot gnu dot org
2009-03-04  1:29 ` jason at gcc dot gnu dot 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).