[Bug c++/34624] New: valid c++ code doesn't compile for x86_64, but for i386

tim at klingt dot org gcc-bugzilla@gcc.gnu.org
Sun Dec 30 13:27:00 GMT 2007


the following code compiles on i386, but not for x86_64:

tim@laptop:~$ g++ -m32 bug.cpp 
tim@laptop:~$ 
tim@laptop:~$ g++ -m64 bug.cpp 
bug.cpp: In function ‘int main()’:
bug.cpp:69: error: no matching function for call to
‘get_samples(my_table<float, 1024u>&)’
tim@laptop:~$ 

#include <boost/array.hpp>

typedef unsigned int uint;

template<typename sampletype, uint size>
struct my_table:
    public boost::array<sampletype, size>
{};

template<typename sampletype, uint size>
inline const sampletype * get_samples(boost::array<sampletype, size> const &
buffer)
{
    return buffer.begin();
}

int main()
{
    my_table<float, 1024> tab;
    const float * ptr = get_samples(tab);
}


i could reproduce it with the debian packages of gcc-4.1 and 4.2 on i386 and
amd64. 

best, tim


-- 
           Summary: valid c++ code doesn't compile for x86_64, but for i386
           Product: gcc
           Version: 4.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tim at klingt dot org


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



More information about the Gcc-bugs mailing list