This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/49808] New: GCC adds an address-of somewhere!


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

           Summary: GCC adds an address-of somewhere!
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dave@boost-consulting.com


Compile the following:

template <class X, X g>
struct A 
{
        A() { float r = g(0); }
};

struct f_t
{
    float operator() (float x) const { return 1; }
};

f_t f;

A<f_t&, f> x;

Now replace "g(0)" with "(*g)(0)".  It compiles!

It's almost as though I had written

A<f_t*, &f> x;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]