Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.md example code triggers static_assert. #8

Open
GravisZro opened this issue Apr 5, 2023 · 0 comments
Open

README.md example code triggers static_assert. #8

GravisZro opened this issue Apr 5, 2023 · 0 comments

Comments

@GravisZro
Copy link

GravisZro commented Apr 5, 2023

    extern const char compressed_data[];
    extern unsigned compressed_data_length;
    extern unsigned char outbuffer[131072];
    
    int result = Deflate(compressed_data+0, compressed_data_length, outbuffer, outbuffer + sizeof(outbuffer));
    if(result != 0) std::fprintf(stderr, "Error\n");

This is the code in question.

The result:

In file included from ../../project/test/test.cpp:13:
../../project/test/TinyDeflate/gunzip.hh: In instantiation of ‘auto gunzip_ns::DeflateOutputDispatch(BtFun&&, InFun&&, T1&&, T2&&) [with unsigned char code = 1; BtFun = DeflateInputDispatch<0, dummy, const char*, unsigned int&, unsigned char (&)[131072], unsigned char*>(dummy&&, const char*&&, unsigned int&, unsigned char (&)[131072], unsigned char*&&)::<lambda(bool)>&; InFun = DeflateInputDispatch<0, dummy, const char*, unsigned int&, unsigned char (&)[131072], unsigned char*>(dummy&&, const char*&&, unsigned int&, unsigned char (&)[131072], unsigned char*&&)::<lambda()>&; T1 = unsigned char (&)[131072]; T2 = unsigned char*]’:
../../project/test/TinyDeflate/gunzip.hh:1386:67:   required from ‘auto gunzip_ns::DeflateInputDispatch(BtFun&&, T1&&, T2&&, T&& ...) [with unsigned char code = 0; BtFun = dummy; T1 = const char*; T2 = unsigned int&; T = {unsigned char (&)[131072], unsigned char*}]’
../../project/test/TinyDeflate/gunzip.hh:1427:46:   required from ‘auto Deflate(T&& ...) [with T = {const char*, unsigned int&, unsigned char (&)[131072], unsigned char*}]’
../../project/test/test.cpp:22:23:   required from here
../../project/test/TinyDeflate/gunzip.hh:1311:31: error: static assertion failed: Deflate: Unknown output parameter type
 1311 |             static_assert(code==0xFF, "Deflate: Unknown output parameter type");
      |                           ~~~~^~~~~~
../../project/test/TinyDeflate/gunzip.hh:1311:31: note: the comparison reduces to ‘(1 == 255)’

I'm using GCC 12 with -std=c++20 if that makes a difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant