public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46691] New: Null pointer in template deduction
@ 2010-11-28 10:25 ilpoilves at hotmail dot com
  2010-11-28 12:08 ` [Bug c++/46691] " paolo.carlini at oracle dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ilpoilves at hotmail dot com @ 2010-11-28 10:25 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Null pointer in template deduction
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ilpoilves@hotmail.com


Have a look at the following code:

template <typename T>
struct identity
{
    typedef T type;
};

template <typename T>
void f(T t, typename identity<T>::type* p)
{
}

int main()
{
    int a = 0;
    f(a, 0);

    return 0;
}

Compiling this on GCC 4.4.5 gives the following error:

g++ test.cpp

test.cpp: "error: no matching function for call to 'f(int&, int)'"

The 0 should match a null pointer. The code is accepted by Visual Studio 2008,
2010, and Comeau C++, all in strict mode.

g++ -v

Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.4-8'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--with-arch-32=i586 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 20100728 (prerelease) (Debian 4.4.4-8)


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

end of thread, other threads:[~2021-09-06 19:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-28 10:25 [Bug c++/46691] New: Null pointer in template deduction ilpoilves at hotmail dot com
2010-11-28 12:08 ` [Bug c++/46691] " paolo.carlini at oracle dot com
2021-05-06 13:44 ` cvs-commit at gcc dot gnu.org
2021-05-07  8:26 ` pault at gcc dot gnu.org
2021-08-28 18:28 ` cvs-commit at gcc dot gnu.org
2021-08-30 20:13 ` cvs-commit at gcc dot gnu.org
2021-09-06 19:03 ` cvs-commit 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).