#include <altivec.h> class Constants { vector unsigned int _pack0; public: Constants() { _pack0 = (vector unsigned int){0xdeadbeef, 0xabababab, 0x55555555, 0x12345678}; }; inline vector unsigned int deadbeef(void) const { return vec_splat(_pack0, 0); }; }; vector unsigned int const_deadbeef(Constants &C) { return C.deadbeef(); } Fails to build with: % $PREFIX/bin/g++ -maltivec -c -Wall av.cpp -o av.o av.cpp: In function `unsigned int __vector__ const_deadbeef(Constants&)': av.cpp:17: error: no matching function for call to `Constants::deadbeef()' av.cpp:10: note: candidates are: unsigned int __vector__ Constants::deadbeef(const Constants*)
Confirmed, a shorter and self contained testcase, resummarizing as this is target independent: #define vector __attribute__((vector_size(16))) struct Constants { inline vector unsigned int deadbeef(void) const { return (vector unsigned int){0xdeadbeef, 0xabababab, 0x55555555, 0x12345678}; }; }; vector unsigned int const_deadbeef(Constants &C) { return C.deadbeef(); }
I am almost sure that the problem which causes PR 9844 also causes this bug.
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01467.html>.
Subject: Bug 13989 CVSROOT: /cvs/gcc Module name: gcc Changes by: fjahanian@gcc.gnu.org 2004-09-23 18:22:27 Modified files: gcc : ChangeLog tree.c gcc/config/rs6000: rs6000.c gcc/cp : cvt.c decl.c parser.c Added files: gcc/testsuite/g++.dg/ext: attribute-test-1.C attribute-test-2.C attribute-test-3.C attribute-test-4.C Log message: PR c++/9844, PR c++/13989 Reviewed by Mark Mitchel. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5587&r2=2.5588 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&r1=1.434&r2=1.435 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&r1=1.714&r2=1.715 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cvt.c.diff?cvsroot=gcc&r1=1.164&r2=1.165 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1303&r2=1.1304 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.253&r2=1.254 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attribute-test-1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attribute-test-2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attribute-test-3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attribute-test-4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed.