[Bug c++/10243] typeof(expr) yields wrong result if expr has reference type
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Dec 24 16:15:00 GMT 2005
------- Comment #6 from pinskia at gcc dot gnu dot org 2005-12-24 16:15 -------
An ever better example comes from PR 25555:
#include <iostream>
using std::cerr;
using std::endl;
template <typename X>
struct test
{
static int const r = 0;
};
template <typename X>
struct test<X&>
{
static int const r = 1;
};
template <typename X>
struct test<X*>
{
static int const r = 2;
};
int
main ()
{
int i;
int& ri = i;
cerr << test<typeof (ri)>::r << endl;
}
This should print 1 but instead prints 0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10243
More information about the Gcc-bugs
mailing list