Skip to content

c++20 undefined behavior usage #300

Closed
@lirik90

Description

@lirik90

What happened?

Hi. It's can't be compiled with this command:

g++ -std=c++20 -fsanitize=undefined test.cpp

Problem in line 86 file include/jwt-cpp/base.h

static std::initializer_list<std::string> fill{"%3D", "%3d"};

How To Reproduce?

#include <jwt-cpp/traits/kazuho-picojson/defaults.h>
int main() {
  return 0;
}

Version

0.6.0

What OS are you seeing the problem on?

Linux

What compiler are you seeing the problem on?

GCC

Relevant log output

[kirill@main-pc test]$ g++ -std=c++20 -fsanitize=undefined ~/test.cpp 
In file included from /jwt-cpp/include/jwt-cpp/jwt.h:12,
                 from /jwt-cpp/include/jwt-cpp/traits/kazuho-picojson/traits.h:12,
                 from /jwt-cpp/include/jwt-cpp/traits/kazuho-picojson/defaults.h:4,
                 from /home/kirill/test.cpp:2:
/jwt-cpp/include/jwt-cpp/base.h: In static member function «static const std::initializer_list<std::__cxx11::basic_string<char> >& jwt::alphabet::helper::base64url_percent_encoding::fill()»:
/jwt-cpp/include/jwt-cpp/base.h:86:100: ошибка: «(((const std::__cxx11::basic_string<char>*)(& <temporary>)) != 0)» не есть константное выражение
   86 |                                         static std::initializer_list<std::string> fill{"%3D", "%3d"};
      |

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions