#C2296'&' illegal, left operand has type 'uint32_t(void)'

44 messages · Page 1 of 1 (latest)

shadow sentinel
#

Here is the code snippet from the code, the line it complains about is the last line in the snippet, };


        //not recommended to temper with
        //T* GetRawData() {
        //    return &(_1_MatrixData[0]);
        //}
        T* GetRawData() { return 0; }
    protected:
        //elem = Ycoord * Size_X + Xcoord;
        T _1_MatrixData[Size_X * Size_Y];

    };

It confuses me as there isn't & in the vicinity.

It's a header file with 275 lines, so I'm not going to post everything here, just the snippet, if you need the rest of the code it's in the "mymath.hpp" header on this repo: https://github.com/siladrenja/sandbox , the error is at the line 114

GitHub

Just a normal repo where I test many ideas. Contribute to siladrenja/sandbox development by creating an account on GitHub.

crude skyBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For more information use !howto ask.

hoary birch
#

@shadow sentinel whenever you have a syntax error, check the lines above and below

shadow sentinel
smoky cedar
#

share the actual compiler error/output

#

instead of the summary of the error

shadow sentinel
#

Severity Code Description Project File Line Suppression State
Error C2296 '&': illegal, left operand has type 'uint32_t (void)' sandbox C:\Users\Matej\source\repos\sandbox\mymath.hpp 114

hoary birch
smoky cedar
#

ok well that's not what I meant

#

this copy-paste comes from the error list/window or whatever

#

go to the output window/pane/panel

shadow sentinel
#

and in command line it's the same thing

smoky cedar
#

make sure it's displaying the build output

#

and share that

shadow sentinel
#

there is a message bellow that which might be useful
message : see reference to class template instantiation 'math::BasicMatrix<Size_X,Size_Y,T,EnableIntrinsics>' being compiled

smoky cedar
#

share your compiler output or provide an actual reproducible example

shadow sentinel
#
Build started...
1>------ Build started: Project: sandbox, Configuration: Debug x64 ------
1>cl : command line warning D9025: overriding '/sdl' with '/GS-'
1>Source.cpp
1>C:\Users\Matej\source\repos\sandbox\mymath.hpp(114,1): error C2296: '&': illegal, left operand has type 'uint32_t (void)'
1>C:\Users\Matej\source\repos\sandbox\mymath.hpp(114): message : see reference to class template instantiation 'math::BasicMatrix<Size_X,Size_Y,T,EnableIntrinsics>' being compiled
1>C:\Users\Matej\source\repos\sandbox\Source.cpp(15,31): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>C:\Users\Matej\source\repos\sandbox\Source.cpp(16,31): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>Done building project "sandbox.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

#

there is the whole compiler output

#

only those lines I sent before seem significant

hoary birch
#
#

There's a lot of errors here even before line 114

#

I can't get your home-rolled intrinsics header to compile

shadow sentinel
#

and other errors are basically because of the lack of that header

smoky cedar
#

I'm a bit too lazy to check the entire template class for uses of &

smoky cedar
#

just making sure, but did you explicitly instantiate the template?

hoary birch
#

That is a good question ^

shadow sentinel
hoary birch
shadow sentinel
# smoky cedar just making sure, but did you explicitly instantiate the template?

yes, I did. My test script is on gitignore so it's not on the repo so here you go:

#include <iostream>
#include <MyIntrinsics.hpp>
#include <library.hpp>
#include <mymath.hpp>


using namespace extstd;
using namespace math;
int main() {

    float a[8][8];
    float b[8][8];
    for (i8 i = 0; i < 8; i++) {
        for (i8 j = 0; j < 8; j++) {
            a[j][i] = (i + 1) * (j + 1);
            b[j][i] = (i + 2) * (j + i);
        }
    }

    BasicMatrix<8, 8, float, false> A(a);
    BasicMatrix<8, 8, float, false> B(b);

    auto C = A * B;

    for (i8 i = 0; i < 8; i++) {
        for (i8 j = 0; j < 8; j++) {
            std::cout << C[j][i] << ' ';
        }
        std::cout << '\n';
    }
    
}

smoky cedar
#

wait, isn't GetIntrinsics a function?

#

this looks wrong (GetIntrinsics & (INTRIN_AVX_512BW || INTRIN_AVX_512F))

shadow sentinel
# smoky cedar can you specify that exactly, because the error message complains that you used ...

These are the only 2 usages of the & operator

BasicMatrix<Size_X, Size_Y, T, EnableIntrinsics> operator+(BasicMatrix<Size_X, Size_Y, T, EnableIntrinsics>& oper) {
            BasicMatrix<Size_X, Size_Y, T, EnableIntrinsics> temp;
            if (!EnableIntrinsics || !(GetIntrinsics() & (INTRIN_AVX2 || INTRIN_AVX || INTRIN_AVX_512BW || INTRIN_AVX_512F))) {


                for (unsigned long long i = 0; i < Size_X * Size_Y; i++) {
                    temp._1_MatrixData[i] = _1_MatrixData[i] + oper._1_MatrixData[i];
                }

                return temp;
            } else if (GetIntrinsics & (INTRIN_AVX_512BW || INTRIN_AVX_512F)) {

                return temp;
            }
        }

        BasicMatrix<Size_X, Size_Y, T, EnableIntrinsics>& operator+=(BasicMatrix<Size_X, Size_Y, T, EnableIntrinsics>& oper) {

            for (unsigned long long i = 0; i < Size_X * Size_Y; i++) {
                _1_MatrixData[i] += oper._1_MatrixData[i];
            }

            return *this;
        }
shadow sentinel
smoky cedar
#

yeah so GetIntrinsic & whatever is wrong

shadow sentinel
#

that fixed it, thanks @hoary birch and @smoky cedar

smoky cedar
#

I'll be honest and admit I'm surprised msvc wasn't more specific about this one

shadow sentinel
#

!solved