public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3518: [2003-05-03] default conversion to pointer-to-function is applied to soon (related to DR295)
@ 2003-05-15 18:20 giovannibajo
  0 siblings, 0 replies; only message in thread
From: giovannibajo @ 2003-05-15 18:20 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, giovannibajo, nathan, nobody

Old Synopsis: [2003-05-03] default conversion applied too soon
New Synopsis: [2003-05-03] default conversion to pointer-to-function is applied to soon (related to DR295)

State-Changed-From-To: feedback->analyzed
State-Changed-By: bajo
State-Changed-When: Thu May 15 18:20:44 2003
State-Changed-Why:
    Ok. I have submitted a new PR (c++/10807) with a testcase
    suming up the whole DR295. This PR is directly related:
    probably when DR295 is implemented correctly, this PR will
    be fixed as well. Anyway, the final testcase for this PR
    is:
    
    -----------------------------------------------
    template <typename T>
    struct check_not_pointer {};
    
    template <typename T>
    struct check_not_pointer<T*>;
    
    struct any
    {
      template <typename T> any (const T&)
      {
          check_not_pointer<T> dummy;
      }
    };
    
    template <typename T> any Foo (const T &s)
    {
        return s;
    }
    
    void f ()
    {}
    
    int main()
    {
      Foo (f);
    }
    -----------------------------------------------
    pr3518.cpp: In constructor `any::any(const T&) [with T = void (*)()]':
    pr3518.cpp:17:   instantiated from `any Foo(T&) [with T = void ()()]'
    pr3518.cpp:25:   instantiated from here
    pr3518.cpp:11: error: `dummy' has incomplete type
    pr3518.cpp:11: error: storage size of `dummy' isn't known
    
    It fails because any::any should be instantiates with
    [T = void (void)], while it gets instantiated with [T = void(*)(void)]
    because the default conversion is applied too soon (and
    DR295 is not implemented).

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3518


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-05-15 18:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-15 18:20 c++/3518: [2003-05-03] default conversion to pointer-to-function is applied to soon (related to DR295) giovannibajo

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