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++/57818] New: A strange template output


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

            Bug ID: 57818
           Summary: A strange template output
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liweifriends at gmail dot com

Hi: I have tried the following code in gcc 4.8.1

template<const float* b>
struct h
{
    static constexpr float value()
    {
        return *b;
    }
};

constexpr float a = 3.0f;

int main()
{
    cout<<a<<endl;                //3
    cout<<h<&a>::value<<endl;     //1
    return 0;
}

the output of h<&a>::value seems not correct. Is this a bug? Or just because
the unsupported of C++ ?


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