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

Testing with examples from https://en.cppreference.com/w/ #314

Open
mingodad opened this issue Jan 1, 2024 · 7 comments
Open

Testing with examples from https://en.cppreference.com/w/ #314

mingodad opened this issue Jan 1, 2024 · 7 comments

Comments

@mingodad
Copy link

mingodad commented Jan 1, 2024

Using the Lua script shown bellow to extract the code examples from https://en.cppreference.com/w/ I'm getting this results:

#cxx
Total files scanned     :	5629
Total files with code   :	2889
Total files failed code :	172

#clang-17
Total files scanned     :	5629
Total files with code   :	2889
Total files failed code :	266

#g++-13
Total files scanned     :	5629
Total files with code   :	2889
Total files failed code :	197

#circle-200
Total files scanned     :	5629
Total files with code   :	2889
Total files failed code :	474
local base_dir = "/home/mingo/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/";

local cppCodeFName = "/tmp/cppCode.cpp";
--local cxx_cmd = "../build/src/frontend/cxx -fsyntax-only -toolchain linux " .. cppCodeFName;
--local cxx_cmd = "/usr/bin/time ../build-release/src/frontend/cxx -fsyntax-only -toolchain linux " .. cppCodeFName;
local cxx_cmd = "/usr/bin/time ./cxx -fsyntax-only -toolchain linux " .. cppCodeFName;
--local cxx_cmd = "clang-17-env /usr/bin/time clang++ -std=c++23 -fsyntax-only " .. cppCodeFName;
--local cxx_cmd = "clang-17-env /usr/bin/time clang++ -fsyntax-only " .. cppCodeFName;
--local cxx_cmd = "gcc-13-env /usr/bin/time g++ -std=c++23 -fsyntax-only " .. cppCodeFName;
--local cxx_cmd = "gcc-13-env /usr/bin/time g++ -fsyntax-only " .. cppCodeFName;
--local cxx_cmd = "/usr/bin/time timeout 3s circle  -std=c++2b -fsyntax-only " .. cppCodeFName;

local code_re = "<div class=\"t%-example%-live%-link\">.-<div class=\"cpp source%-cpp\">(.-)</pre></div>";

local find_cmd = "find " .. base_dir .. " -name '*.html'";
local start_t = os.time();

local html_list = {};
for fname in io.popen(find_cmd, "r"):lines("l") do
	table.insert(html_list, fname);
end
table.sort(html_list);

local count_with_code = 0;
local fname_with_code_failed = {};
for idx, fname in ipairs(html_list) do
	print(fname);

	local html = io.open(fname, "r"):read("a");
	for code in html:gmatch(code_re) do
		code = code:gsub("%b<>", "");
		code = code:gsub("&nbsp;", " ");
		code = code:gsub("&lt;", "<");
		code = code:gsub("&gt;", ">");
		code = code:gsub("&amp;", "&");

		--print("//====Start");
		--print(code);
		--print("//====End");

		local fd = io.open(cppCodeFName, "w");
		fd:write(code);
		fd:close();
		count_with_code = count_with_code + 1;
		print("==CHECK==")
		print(cxx_cmd);
		io.stdout:flush();
		local rc, rc_type, rc_code = os.execute(cxx_cmd);
		if rc_code == 0 then
			print("==rc:OK==")
		else
			table.insert(fname_with_code_failed, idx);
			print("==rc:FAILED==")
			print("//====Start");
			print(code);
			print("//====End");
		end
	end

end
local end_t = os.time();
print("elapsed time: ", os.difftime(end_t, start_t));
print("Total files scanned     :", #html_list);
print("Total files with code   :", count_with_code);
print("Total files failed code :", #fname_with_code_failed);
for idx, fname_idx in ipairs(fname_with_code_failed) do
	print(html_list[fname_idx]);
end

See attached the output for cxx and clang-17:
test-cpp-reference-examples-cxx.output.zip
test-cpp-reference-examples-clang-17-std23.output.zip

@mingodad
Copy link
Author

mingodad commented Jan 2, 2024

Also testing https://github.com/abseil/abseil-cpp with the Lua script shown bellow gives this result:

#cxx
Total files scanned     :	172
Total files with code   :	0
Total files failed code :	47

#clang-17
Total files scanned     :	172
Total files with code   :	0
Total files failed code :	3

#g++-13
Total files scanned     :	172
Total files with code   :	0
Total files failed code :	71

#circle-200
Total files scanned     :	172
Total files with code   :	0
Total files failed code :	59
local base_dir = "/home/mingo/dev/c/A_libs/abseil-cpp/absl/";

--local cxx_cmd = "/usr/bin/time ../build/src/frontend/cxx -fsyntax-only -toolchain linux ";
local cxx_cmd = "/usr/bin/time ../build-release/src/frontend/cxx -fsyntax-only -toolchain linux ";
--local cxx_cmd = "clang-17-env /usr/bin/time clang++ -std=c++14 -fsyntax-only ";
--local cxx_cmd = "clang-17-env /usr/bin/time clang++ -fsyntax-only ";
--local cxx_cmd = "gcc-13-env /usr/bin/time g++ -std=c++14 -fsyntax-only ";
--local cxx_cmd = "gcc-13-env /usr/bin/time g++ -fsyntax-only ";
--local cxx_cmd = "/usr/bin/time timeout 3s circle -fsyntax-only ";


local find_cmd = "find " .. base_dir .. " -name '*.cc'";
local start_t = os.time();

local cpp_list = {};
for fname in io.popen(find_cmd, "r"):lines("l") do
	if not (fname:match("_test.cc$") or fname:match("_benchmark.cc$")) then
		table.insert(cpp_list, fname);
	end
end
table.sort(cpp_list);

local count_with_code = 0;
local fname_with_code_failed = {};
for idx, fname in ipairs(cpp_list) do
	print(fname);

	local cmd = cxx_cmd .. fname .. " -I" .. base_dir .. "..";
	print("==CHECK==")
	print(cmd);
	io.stdout:flush();
	local rc = os.execute(cmd);
	if rc then
		print("==rc:OK==")
	else
		table.insert(fname_with_code_failed, idx);
		print("==rc:FAILED==")
	end

end
local end_t = os.time();
print("elapsed time: ", os.difftime(end_t, start_t));
print("Total files scanned     :", #cpp_list);
print("Total files with code   :", count_with_code);
print("Total files failed code :", #fname_with_code_failed);
for idx, fname_idx in ipairs(fname_with_code_failed) do
	print(cpp_list[fname_idx]);
end

See attached cxx and clang output:
test-abseil-cpp-cxx.output.zip
test-abseil-cpp-clang17.output.zip

@robertoraggi
Copy link
Owner

This looks very helpful, thanks for sharing. I will have a look at the failures, do you have a repo for this?

@mingodad
Copy link
Author

mingodad commented Jan 2, 2024

No repo only the Lua script and you can download the offline cpp-reference from here https://en.cppreference.com/w/Cppreference:Archives .

@mingodad
Copy link
Author

Now when trying to test I'm getting errors that was not happening before:

/home/mingo/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/algorithm/accumulate.html
==CHECK==
/usr/bin/time ./cxx -fsyntax-only -toolchain linux /tmp/cppCode.cpp
/usr/include/c++/11/ext/numeric_traits.h:72:57: expected '('
	= __is_integer_nonstrict<_Value>::__width - __is_signed;
	                                                       ^
/usr/include/c++/11/ext/numeric_traits.h:76:2: expected '('
	? (((((_Value)1 << (__digits - 1)) - 1) << 1) + 1)
	^
/usr/include/c++/11/ext/numeric_traits.h:78:47: expected '('
      static const _Value __min = __is_signed ? -__max - 1 : (_Value)0;
                                              ^
/usr/include/c++/11/bits/stl_algobase.h:907:40: expected '('
    __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, void>::__type
                                       ^
/usr/include/c++/11/bits/stl_algobase.h:907:54: expected a declaration
    __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, void>::__type
                                                     ^
/usr/include/c++/11/bits/stl_algobase.h:907:60: expected a declaration
    __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, void>::__type
                                                           ^
/usr/include/c++/11/bits/stl_algobase.h:1055:40: expected '('
    __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type
                                       ^
/usr/include/c++/11/bits/stl_algobase.h:1055:54: expected a declaration
    __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type
                                                     ^
/usr/include/c++/11/bits/stl_algobase.h:1055:71: expected a declaration
    __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type
                                                                      ^
/usr/include/c++/11/bits/stl_algobase.h:1372:18: expected '('
	 && __is_pointer<_II1>::__value
	                ^
/usr/include/c++/11/bits/stl_algobase.h:1373:18: expected '('
	 && __is_pointer<_II2>::__value
	                ^
Command exited with non-zero status 1
0.22user 0.03system 0:00.26elapsed 98%CPU (0avgtext+0avgdata 51712maxresident)k
104inputs+0outputs (0major+13959minor)pagefaults 0swaps
==rc:FAILED==

@robertoraggi
Copy link
Owner

I see, I think I broke this when I started reworking the support for the built-in type traits.
#359 should fix it, I also added some code to test the linux toolchain in the CI workflow.
Thanks for the report.

@mingodad
Copy link
Author

mingodad commented Nov 3, 2024

Testing again using libc++ from gcc-14.2.0 I'm getting this failures:

$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/algorithm/ranges/generate_n.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:29:58: expected an expression
    std::ranges::generate_n(v.begin(), v.size(), [n {0}] mutable { return n++; });
                                                         ^
/tmp/cppCode.cpp:29:81: expected a statement
    std::ranges::generate_n(v.begin(), v.size(), [n {0}] mutable { return n++; });
                                                                                ^
Command exited with non-zero status 1
0.33user 0.03system 0:00.37elapsed 100%CPU (0avgtext+0avgdata 66312maxresident)k
0inputs+0outputs (0major+17828minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <algorithm>
#include <array>
#include <iostream>
#include <random>
#include <string_view>

auto dice()
{
    static std::uniform_int_distribution<int> distr {1, 6};
    static std::random_device engine;
    static std::mt19937 noise {engine()};
    return distr(noise);
}

void print(const auto& v, std::string_view comment)
{
    for (int i : v)
        std::cout << i << ' ';
    std::cout << '(' << comment << ")\n";
}

int main()
{
    std::array<int, 8> v;

    std::ranges::generate_n(v.begin(), v.size(), dice);
    print(v, "dice");

    std::ranges::generate_n(v.begin(), v.size(), [n {0}] mutable { return n++; });
    // same effect as std::iota(v.begin(), v.end(), 0);
    print(v, "iota");
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/algorithm/search.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:29:5: expected a statement
    constexpr auto quote
    ^
/tmp/cppCode.cpp:32:9: expected ';'
        "do eiusmod tempor incididunt ut labore et dolore magna aliqua"sv
        ^
/tmp/cppCode.cpp:33:5: expected ';'
    };
    ^
Command exited with non-zero status 1
0.30user 0.03system 0:00.33elapsed 99%CPU (0avgtext+0avgdata 62120maxresident)k
0inputs+0outputs (0major+16836minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <algorithm>
#include <cassert>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <string_view>
#include <vector>

using namespace std::literals;

bool contains(const auto& cont, std::string_view s)
{
    // str.find() (or str.contains(), since C++23) can be used as well
    return std::search(cont.begin(), cont.end(), s.begin(), s.end()) != cont.end();
}

int main()
{
    const auto str{"why waste time learning, when ignorance is instantaneous?"sv};
    assert(contains(str, "learning"));
    assert(not contains(str, "lemming"));

    const std::vector vec(str.begin(), str.end());
    assert(contains(vec, "learning"));
    assert(not contains(vec, "leaning"));

    // The C++17 overload with searchers demo:
    constexpr auto quote
    {
        "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed "
        "do eiusmod tempor incididunt ut labore et dolore magna aliqua"sv
    };

    for (const auto word : {"pisci"sv, "Pisci"sv})
    {
        std::cout << "The string " << std::quoted(word) << ' ';
        const std::boyer_moore_searcher searcher(word.begin(), word.end());
        const auto it = std::search(quote.begin(), quote.end(), searcher);
        if (it == quote.end())
            std::cout << "not found\n";
        else
            std::cout << "found at offset " << std::distance(quote.begin(), it) << '\n';
    }
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/chrono/duration/floor.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:9:10: expected an expression
    for (using Sec = std::chrono::seconds;
         ^
/tmp/cppCode.cpp:10:9: expected a statement
        auto const d : {+4999ms, +5000ms, +5001ms, +5499ms, +5500ms, +5999ms,
        ^
/tmp/cppCode.cpp:11:77: expected ';'
                        -4999ms, -5000ms, -5001ms, -5499ms, -5500ms, -5999ms})
                                                                            ^
/tmp/cppCode.cpp:11:78: expected a statement
                        -4999ms, -5000ms, -5001ms, -5499ms, -5500ms, -5999ms})
                                                                             ^
Command exited with non-zero status 1
0.37user 0.03system 0:00.41elapsed 99%CPU (0avgtext+0avgdata 72700maxresident)k
0inputs+0outputs (0major+19450minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <chrono>
#include <iomanip>
#include <iostream>

int main()
{
    using namespace std::chrono_literals;
    std::cout << "Duration\tFloor\tRound\tCeil\n";
    for (using Sec = std::chrono::seconds;
        auto const d : {+4999ms, +5000ms, +5001ms, +5499ms, +5500ms, +5999ms,
                        -4999ms, -5000ms, -5001ms, -5499ms, -5500ms, -5999ms})
        std::cout << std::showpos << d << "\t\t"
                  << std::chrono::floor<Sec>(d) << '\t'
                  << std::chrono::round<Sec>(d) << '\t'
                  << std::chrono::ceil <Sec>(d) << '\n';
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/coroutine/generator.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:10:19: expected a declarator
    std::generator<const T&> traverse_inorder() const
                  ^
/tmp/cppCode.cpp:10:27: expected a declarator
    std::generator<const T&> traverse_inorder() const
                          ^
/tmp/cppCode.cpp:10:28: expected a declaration
    std::generator<const T&> traverse_inorder() const
                           ^
Command exited with non-zero status 1
0.23user 0.03system 0:00.26elapsed 99%CPU (0avgtext+0avgdata 42288maxresident)k
48inputs+0outputs (0major+10867minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <generator>
#include <iostream>

template<typename T>
struct Tree
{
    T value;
    Tree *left{}, *right{};

    std::generator<const T&> traverse_inorder() const
    {
        if (left)
            for (const T& x : left->traverse_inorder())
                co_yield x;

        co_yield value;
        if (right)
            for (const T& x : right->traverse_inorder())
                co_yield x;
    }
};

int main()
{
    Tree<char> tree[]
    {
                                    {'D', tree + 1, tree + 2},
        //                            │
        //            ┌───────────────┴────────────────┐
        //            │                                │
                    {'B', tree + 3, tree + 4},       {'F', tree + 5, tree + 6},
        //            │                                │
        //  ┌─────────┴─────────────┐      ┌───────────┴─────────────┐
        //  │                       │      │                         │
          {'A'},                  {'C'}, {'E'},                    {'G'}
    };

    for (char x : tree->traverse_inorder())
        std::cout << x << ' ';
    std::cout << '\n';
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/error/bad_exception.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:11:11: expected ')'
    throw(std::bad_exception) // Dynamic exception specifications
          ^
/tmp/cppCode.cpp:11:29: expected a declaration
    throw(std::bad_exception) // Dynamic exception specifications
                            ^
/tmp/cppCode.cpp:13:1: expected a declaration
{
^
/tmp/cppCode.cpp:14:5: expected a declaration
    throw std::runtime_error("test");
    ^
/tmp/cppCode.cpp:14:29: expected a declaration
    throw std::runtime_error("test");
                            ^
/tmp/cppCode.cpp:14:30: expected a declaration
    throw std::runtime_error("test");
                             ^
/tmp/cppCode.cpp:14:36: expected a declaration
    throw std::runtime_error("test");
                                   ^
/tmp/cppCode.cpp:15:1: expected a declaration
}
^
Command exited with non-zero status 1
0.17user 0.01system 0:00.19elapsed 99%CPU (0avgtext+0avgdata 36304maxresident)k
0inputs+0outputs (0major+9361minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <exception>
#include <iostream>
#include <stdexcept>

void my_unexp()
{
    throw;
}

void test()
    throw(std::bad_exception) // Dynamic exception specifications
                              // are deprecated in C++11
{
    throw std::runtime_error("test");
}

int main()
{
    std::set_unexpected(my_unexp); // Deprecated in C++11, removed in C++17

    try
    {
        test();
    }
    catch (const std::bad_exception& e)
    {
        std::cerr << "Caught " << e.what() << '\n';
    }
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/experimental/constraints.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:9:9: expected '<identifier>'
concept bool EqualityComparable = requires(T a, T b) {
        ^
/tmp/cppCode.cpp:10:19: expected type constraint
    { a == b } -> bool;
                  ^
/tmp/cppCode.cpp:10:23: expected an expression
    { a == b } -> bool;
                      ^
Command exited with non-zero status 1
0.19user 0.02system 0:00.22elapsed 99%CPU (0avgtext+0avgdata 37796maxresident)k
0inputs+0outputs (0major+9751minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <string>
#include <locale>
using namespace std::literals;

// Declaration of the concept "EqualityComparable", which is satisfied by
// any type T such that for values a and b of type T,
// the expression a==b compiles and its result is convertible to bool
template<typename T>
concept bool EqualityComparable = requires(T a, T b) {
    { a == b } -> bool;
};

void f(EqualityComparable&&); // declaration of a constrained function template
// template<typename T>
// void f(T&&) requires EqualityComparable<T>; // long form of the same

int main() {
  f("abc"s); // OK, std::string is EqualityComparable
  f(std::use_facet<std::ctype<char>>(std::locale{})); // Error: not EqualityComparable
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/iterator/basic_const_iterator/operator_cmp2.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:6:5: expected a statement
    static constexpr std::basic_const_iterator<int*> it = std::end(arr);
    ^
Command exited with non-zero status 1
0.14user 0.01system 0:00.16elapsed 100%CPU (0avgtext+0avgdata 31504maxresident)k
0inputs+0outputs (0major+8156minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <iterator>

int main()
{
    static int arr[1];
    static constexpr std::basic_const_iterator<int*> it = std::end(arr);
    static_assert(arr < it);
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/language/alignas.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:17:21: expected a type id
using cacheline_t = alignas(64) char[64];
                    ^
/tmp/cppCode.cpp:17:37: expected a declaration
using cacheline_t = alignas(64) char[64];
                                    ^
/tmp/cppCode.cpp:17:38: expected a declaration
using cacheline_t = alignas(64) char[64];
                                     ^
/tmp/cppCode.cpp:17:40: expected a declaration
using cacheline_t = alignas(64) char[64];
                                       ^
Command exited with non-zero status 1
0.16user 0.02system 0:00.18elapsed 99%CPU (0avgtext+0avgdata 36284maxresident)k
0inputs+0outputs (0major+9401minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <iostream>

// Every object of type struct_float will be aligned
// to alignof(float) boundary (usually 4):
struct alignas(float) struct_float
{
    // your definition here
};

// Every object of type sse_t will be aligned to 32-byte boundary:
struct alignas(32) sse_t
{
    float sse_data[4];
};

// The array "cacheline" will be aligned to 64-byte boundary:
using cacheline_t = alignas(64) char[64];
cacheline_t cacheline;

int main()
{
    struct default_aligned
    {
        float data[4];
    } a, b, c;
    sse_t x, y, z;

    std::cout
        << "alignof(struct_float) = " << alignof(struct_float) << '\n'
        << "sizeof(sse_t) = " << sizeof(sse_t) << '\n'
        << "alignof(sse_t) = " << alignof(sse_t) << '\n'
        << "alignof(cacheline_t) = " << alignof(cacheline_t) << '\n'
        << "alignof(cacheline) = " << alignof(decltype(cacheline)) << '\n'
        << std::hex << std::showbase
        << "&a: " << &a << "\n"
           "&b: " << &b << "\n"
           "&c: " << &c << "\n"
           "&x: " << &x << "\n"
           "&y: " << &y << "\n"
           "&z: " << &z << '\n';
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/language/attributes.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:1:49: expected a declaration
[[gnu::always_inline]] [[gnu::hot]] [[gnu::const]] [[nodiscard]]
                                                ^
/tmp/cppCode.cpp:1:50: expected a declaration
[[gnu::always_inline]] [[gnu::hot]] [[gnu::const]] [[nodiscard]]
                                                 ^
/tmp/cppCode.cpp:4:33: expected a declaration
[[gnu::always_inline, gnu::const, gnu::hot, nodiscard]]
                                ^
/tmp/cppCode.cpp:4:43: expected a declaration
[[gnu::always_inline, gnu::const, gnu::hot, nodiscard]]
                                          ^
/tmp/cppCode.cpp:4:54: expected a declaration
[[gnu::always_inline, gnu::const, gnu::hot, nodiscard]]
                                                     ^
/tmp/cppCode.cpp:4:55: expected a declaration
[[gnu::always_inline, gnu::const, gnu::hot, nodiscard]]
                                                      ^
/tmp/cppCode.cpp:8:20: expected a declaration
[[using gnu : const, always_inline, hot]] [[nodiscard]]
                   ^
/tmp/cppCode.cpp:8:35: expected a declaration
[[using gnu : const, always_inline, hot]] [[nodiscard]]
                                  ^
/tmp/cppCode.cpp:8:40: expected a declaration
[[using gnu : const, always_inline, hot]] [[nodiscard]]
                                       ^
/tmp/cppCode.cpp:8:41: expected a declaration
[[using gnu : const, always_inline, hot]] [[nodiscard]]
                                        ^
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 3828maxresident)k
0inputs+0outputs (0major+176minor)pagefaults 0swaps
==rc:FAILED==
//====Start
[[gnu::always_inline]] [[gnu::hot]] [[gnu::const]] [[nodiscard]]
inline int f(); // declare f with four attributes

[[gnu::always_inline, gnu::const, gnu::hot, nodiscard]]
int f(); // same as above, but uses a single attr specifier that contains four attributes

// C++17:
[[using gnu : const, always_inline, hot]] [[nodiscard]]
int f[[gnu::always_inline]](); // an attribute may appear in multiple specifiers

int f() { return 0; }

int main() {}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/language/except_spec.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:10:16: expected ')'
void f() throw(X, Y)
               ^
/tmp/cppCode.cpp:10:17: expected a declaration
void f() throw(X, Y)
                ^
/tmp/cppCode.cpp:10:20: expected a declaration
void f() throw(X, Y)
                   ^
/tmp/cppCode.cpp:11:1: expected a declaration
{
^
/tmp/cppCode.cpp:14:5: expected a declaration
    if (n)
    ^
/tmp/cppCode.cpp:14:8: expected a declaration
    if (n)
       ^
/tmp/cppCode.cpp:14:10: expected a declaration
    if (n)
         ^
/tmp/cppCode.cpp:15:9: expected a declaration
        throw X(); // OK, would call std::terminate()
        ^
/tmp/cppCode.cpp:16:5: expected a declaration
    if (n)
    ^
/tmp/cppCode.cpp:16:8: expected a declaration
    if (n)
       ^
/tmp/cppCode.cpp:16:10: expected a declaration
    if (n)
         ^
/tmp/cppCode.cpp:17:9: expected a declaration
        throw Z(); // also OK
        ^
/tmp/cppCode.cpp:19:5: expected a declaration
    throw W(); // will call std::unexpected()
    ^
/tmp/cppCode.cpp:20:1: expected a declaration
}
^
Command exited with non-zero status 1
0.16user 0.02system 0:00.19elapsed 100%CPU (0avgtext+0avgdata 36304maxresident)k
0inputs+0outputs (0major+9397minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <cstdlib>
#include <exception>
#include <iostream>

class X {};
class Y {};
class Z : public X {};
class W {};

void f() throw(X, Y)
{
    bool n = false;

    if (n)
        throw X(); // OK, would call std::terminate()
    if (n)
        throw Z(); // also OK

    throw W(); // will call std::unexpected()
}

void handler()
{
    std::cerr << "That was unexpected!\n"; // flush needed
    std::abort();
}

int main()
{
    std::set_unexpected(handler);
    f();
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/language/operator_alternative.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:1:1: expected a declaration
%:include <iostream>
^
/tmp/cppCode.cpp:1:2: expected a declaration
%:include <iostream>
 ^
/tmp/cppCode.cpp:1:11: expected a declaration
%:include <iostream>
          ^
/tmp/cppCode.cpp:1:20: expected a declaration
%:include <iostream>
                   ^
/tmp/cppCode.cpp:3:8: expected a template-id
struct X
       ^
/tmp/cppCode.cpp:4:1: expected a declaration
<%
^
/tmp/cppCode.cpp:4:2: expected a declaration
<%
 ^
/tmp/cppCode.cpp:5:5: expected a declaration
    compl X() <%%> // destructor
    ^
/tmp/cppCode.cpp:5:12: expected a declaration
    compl X() <%%> // destructor
           ^
/tmp/cppCode.cpp:5:13: expected a declaration
    compl X() <%%> // destructor
            ^
/tmp/cppCode.cpp:5:15: expected a declaration
    compl X() <%%> // destructor
              ^
/tmp/cppCode.cpp:5:16: expected a declaration
    compl X() <%%> // destructor
               ^
/tmp/cppCode.cpp:5:17: expected a declaration
    compl X() <%%> // destructor
                ^
/tmp/cppCode.cpp:5:18: expected a declaration
    compl X() <%%> // destructor
                 ^
/tmp/cppCode.cpp:6:6: expected a declaration
    X() <%%>
     ^
/tmp/cppCode.cpp:6:7: expected a declaration
    X() <%%>
      ^
/tmp/cppCode.cpp:6:9: expected a declaration
    X() <%%>
        ^
/tmp/cppCode.cpp:6:10: expected a declaration
    X() <%%>
         ^
/tmp/cppCode.cpp:6:11: expected a declaration
    X() <%%>
          ^
/tmp/cppCode.cpp:6:12: expected a declaration
    X() <%%>
           ^
/tmp/cppCode.cpp:11:5: expected a declaration
    <%
    ^
/tmp/cppCode.cpp:11:6: expected a declaration
    <%
     ^
/tmp/cppCode.cpp:12:8: expected a declaration
       return this not_eq bitand other;
       ^
/tmp/cppCode.cpp:12:15: expected a declaration
       return this not_eq bitand other;
              ^
/tmp/cppCode.cpp:12:20: expected a declaration
       return this not_eq bitand other;
                   ^
/tmp/cppCode.cpp:12:27: expected a declaration
       return this not_eq bitand other;
                          ^
/tmp/cppCode.cpp:12:39: expected a declaration
       return this not_eq bitand other;
                                      ^
/tmp/cppCode.cpp:13:5: expected a declaration
    %>
    ^
/tmp/cppCode.cpp:13:6: expected a declaration
    %>
     ^
/tmp/cppCode.cpp:14:1: expected a declaration
%>;
^
/tmp/cppCode.cpp:14:2: expected a declaration
%>;
 ^
/tmp/cppCode.cpp:16:10: expected an expression
int main(int argc, char* argv<::>)
         ^
/tmp/cppCode.cpp:16:20: expected a declaration
int main(int argc, char* argv<::>)
                   ^
/tmp/cppCode.cpp:16:30: expected a declaration
int main(int argc, char* argv<::>)
                             ^
/tmp/cppCode.cpp:16:31: expected a declaration
int main(int argc, char* argv<::>)
                              ^
/tmp/cppCode.cpp:16:33: expected a declaration
int main(int argc, char* argv<::>)
                                ^
/tmp/cppCode.cpp:16:34: expected a declaration
int main(int argc, char* argv<::>)
                                 ^
/tmp/cppCode.cpp:17:1: expected a declaration
<%
^
/tmp/cppCode.cpp:17:2: expected a declaration
<%
 ^
/tmp/cppCode.cpp:19:18: expected an expression
    auto greet = <:bitand:>(const char* name)
                 ^
/tmp/cppCode.cpp:19:19: expected a declaration
    auto greet = <:bitand:>(const char* name)
                  ^
/tmp/cppCode.cpp:19:20: expected a declaration
    auto greet = <:bitand:>(const char* name)
                   ^
/tmp/cppCode.cpp:19:26: expected a declaration
    auto greet = <:bitand:>(const char* name)
                         ^
/tmp/cppCode.cpp:19:27: expected a declaration
    auto greet = <:bitand:>(const char* name)
                          ^
/tmp/cppCode.cpp:19:28: expected a declaration
    auto greet = <:bitand:>(const char* name)
                           ^
/tmp/cppCode.cpp:19:45: expected a declaration
    auto greet = <:bitand:>(const char* name)
                                            ^
/tmp/cppCode.cpp:20:5: expected a declaration
    <%
    ^
/tmp/cppCode.cpp:20:6: expected a declaration
    <%
     ^
/tmp/cppCode.cpp:21:19: expected a declaration
        std::cout << "Hello " << name
                  ^
/tmp/cppCode.cpp:21:22: expected a declaration
        std::cout << "Hello " << name
                     ^
/tmp/cppCode.cpp:21:31: expected a declaration
        std::cout << "Hello " << name
                              ^
/tmp/cppCode.cpp:22:19: expected a declaration
                  << " from " << argv<:0:> << '\n';
                  ^
/tmp/cppCode.cpp:22:22: expected a declaration
                  << " from " << argv<:0:> << '\n';
                     ^
/tmp/cppCode.cpp:22:31: expected a declaration
                  << " from " << argv<:0:> << '\n';
                              ^
/tmp/cppCode.cpp:22:38: expected a declaration
                  << " from " << argv<:0:> << '\n';
                                     ^
/tmp/cppCode.cpp:22:39: expected a declaration
                  << " from " << argv<:0:> << '\n';
                                      ^
/tmp/cppCode.cpp:22:40: expected a declaration
                  << " from " << argv<:0:> << '\n';
                                       ^
/tmp/cppCode.cpp:22:41: expected a declaration
                  << " from " << argv<:0:> << '\n';
                                        ^
/tmp/cppCode.cpp:22:42: expected a declaration
                  << " from " << argv<:0:> << '\n';
                                         ^
/tmp/cppCode.cpp:22:44: expected a declaration
                  << " from " << argv<:0:> << '\n';
                                           ^
/tmp/cppCode.cpp:22:47: expected a declaration
                  << " from " << argv<:0:> << '\n';
                                              ^
/tmp/cppCode.cpp:23:5: expected a declaration
    %>;
    ^
/tmp/cppCode.cpp:23:6: expected a declaration
    %>;
     ^
/tmp/cppCode.cpp:25:5: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
    ^
/tmp/cppCode.cpp:25:8: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
       ^
/tmp/cppCode.cpp:25:14: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
             ^
/tmp/cppCode.cpp:25:16: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
               ^
/tmp/cppCode.cpp:25:18: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
                 ^
/tmp/cppCode.cpp:25:26: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
                         ^
/tmp/cppCode.cpp:25:27: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
                          ^
/tmp/cppCode.cpp:25:28: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
                           ^
/tmp/cppCode.cpp:25:29: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
                            ^
/tmp/cppCode.cpp:25:30: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
                             ^
/tmp/cppCode.cpp:25:32: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
                               ^
/tmp/cppCode.cpp:25:39: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
                                      ^
/tmp/cppCode.cpp:25:46: expected a declaration
    if (argc > 1 and argv<:1:> not_eq nullptr)
                                             ^
/tmp/cppCode.cpp:26:14: expected a declaration
        greet(argv<:1:>);
             ^
/tmp/cppCode.cpp:26:19: expected a declaration
        greet(argv<:1:>);
                  ^
/tmp/cppCode.cpp:26:20: expected a declaration
        greet(argv<:1:>);
                   ^
/tmp/cppCode.cpp:26:21: expected a declaration
        greet(argv<:1:>);
                    ^
/tmp/cppCode.cpp:26:22: expected a declaration
        greet(argv<:1:>);
                     ^
/tmp/cppCode.cpp:26:23: expected a declaration
        greet(argv<:1:>);
                      ^
/tmp/cppCode.cpp:26:24: expected a declaration
        greet(argv<:1:>);
                       ^
/tmp/cppCode.cpp:27:5: expected a declaration
    else
    ^
/tmp/cppCode.cpp:28:14: expected a declaration
        greet("Anon");
             ^
/tmp/cppCode.cpp:28:15: expected a declaration
        greet("Anon");
              ^
/tmp/cppCode.cpp:28:21: expected a declaration
        greet("Anon");
                    ^
/tmp/cppCode.cpp:29:1: expected a declaration
%>
^
/tmp/cppCode.cpp:29:2: expected a declaration
%>
 ^
/tmp/cppCode.cpp:29:3: expected a declaration
%>
  ^
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 3888maxresident)k
0inputs+0outputs (0major+178minor)pagefaults 0swaps
==rc:FAILED==
//====Start
%:include <iostream>

struct X
<%
    compl X() <%%> // destructor
    X() <%%>
    X(const X bitand) = delete; // copy constructor
    // X(X and) = delete; // move constructor

    bool operator not_eq(const X bitand other)
    <%
       return this not_eq bitand other;
    %>
%>;

int main(int argc, char* argv<::>)
<%
    // lambda with reference-capture:
    auto greet = <:bitand:>(const char* name)
    <%
        std::cout << "Hello " << name
                  << " from " << argv<:0:> << '\n';
    %>;

    if (argc > 1 and argv<:1:> not_eq nullptr)
        greet(argv<:1:>);
    else
        greet("Anon");
%>
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/language/range-for.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:49:10: expected an expression
    for (using elem_t = decltype(v)::value_type; elem_t i : v)
         ^
/tmp/cppCode.cpp:49:57: expected ';'
    for (using elem_t = decltype(v)::value_type; elem_t i : v)
                                                        ^
/tmp/cppCode.cpp:49:62: expected ';'
    for (using elem_t = decltype(v)::value_type; elem_t i : v)
                                                             ^
Command exited with non-zero status 1
0.19user 0.02system 0:00.22elapsed 99%CPU (0avgtext+0avgdata 40044maxresident)k
0inputs+0outputs (0major+10281minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <iostream>
#include <vector>

int main()
{
    std::vector<int> v = {0, 1, 2, 3, 4, 5};

    for (const int& i : v) // access by const reference
        std::cout << i << ' ';
    std::cout << '\n';

    for (auto i : v) // access by value, the type of i is int
        std::cout << i << ' ';
    std::cout << '\n';

    for (auto&& i : v) // access by forwarding reference, the type of i is int&
        std::cout << i << ' ';
    std::cout << '\n';

    const auto& cv = v;

    for (auto&& i : cv) // access by f-d reference, the type of i is const int&
        std::cout << i << ' ';
    std::cout << '\n';

    for (int n : {0, 1, 2, 3, 4, 5}) // the initializer may be a
                                     // braced-enclosed initializer list
        std::cout << n << ' ';
    std::cout << '\n';

    int a[] = {0, 1, 2, 3, 4, 5};
    for (int n : a) // the initializer may be an array
        std::cout << n << ' ';
    std::cout << '\n';

    for ([[maybe_unused]] int n : a)
        std::cout << 1 << ' '; // the loop variable need not be used
    std::cout << '\n';

    for (auto n = v.size(); auto i : v) // the init-statement (C++20)
        std::cout << --n + i << ' ';
    std::cout << '\n';

    for (typedef decltype(v)::value_type elem_t; elem_t i : v)
    // typedef declaration as init-statement (C++20)
        std::cout << i << ' ';
    std::cout << '\n';

    for (using elem_t = decltype(v)::value_type; elem_t i : v)
    // alias declaration as init-statement (C++23)
        std::cout << i << ' ';
    std::cout << '\n';
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/language/string_literal.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:22:27: expected a declaration
const char16_t* s9 = "MN" u"OP" "QR"; // ok, same as
                          ^
Command exited with non-zero status 1
0.17user 0.02system 0:00.20elapsed 100%CPU (0avgtext+0avgdata 36356maxresident)k
0inputs+0outputs (0major+9403minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <iostream>

char array1[] = "Foo" "bar";
// same as
char array2[] = { 'F', 'o', 'o', 'b', 'a', 'r', '\0' };

const char* s1 = R"foo(
Hello
  World
)foo";
// same as
const char* s2 = "\nHello\n  World\n";
// same as
const char* s3 = "\n"
                 "Hello\n"
                 "  World\n";

const wchar_t* s4 = L"ABC" L"DEF"; // ok, same as
const wchar_t* s5 = L"ABCDEF";
const char32_t* s6 = U"GHI" "JKL"; // ok, same as
const char32_t* s7 = U"GHIJKL";
const char16_t* s9 = "MN" u"OP" "QR"; // ok, same as
const char16_t* sA = u"MNOPQR";

// const auto* sB = u"Mixed" U"Types";
        // before C++23 may or may not be supported by
        // the implementation; ill-formed since C++23

const wchar_t* sC = LR"--(STUV)--"; // ok, raw string literal

int main()
{
    std::cout << array1 << ' ' << array2 << '\n'
              << s1 << s2 << s3 << std::endl;
    std::wcout << s4 << ' ' << s5 << ' ' << sC
               << std::endl;
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/language/transactional_memory.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:9:33: expected '}'
        std::cout << i << " -> ";
                                ^
/tmp/cppCode.cpp:14:1: expected a declaration
}
^
Command exited with non-zero status 1
0.24user 0.02system 0:00.27elapsed 99%CPU (0avgtext+0avgdata 49028maxresident)k
0inputs+0outputs (0major+13563minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <iostream>
#include <thread>
#include <vector>

int f()
{
    static int i = 0;
    synchronized { // begin synchronized block
        std::cout << i << " -> ";
        ++i;       // each call to f() obtains a unique value of i
        std::cout << i << '\n';
        return i;  // end synchronized block
    }
}

int main()
{
    std::vector<std::thread> v(10);
    for (auto& t : v)
        t = std::thread([] { for (int n = 0; n < 10; ++n) f(); });
    for (auto& t : v)
        t.join();
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/memory/scoped_allocator_adaptor.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/usr/include/boost/interprocess/detail/atomic.hpp:186:30: expected ')'
   __asm__ __volatile__ ( "" ::: "memory" );
                             ^
/usr/include/boost/interprocess/detail/atomic.hpp:199:7: expected ')'
      :: "memory"
      ^
Command exited with non-zero status 1
0.67user 0.07system 0:00.80elapsed 92%CPU (0avgtext+0avgdata 118524maxresident)k
5944inputs+0outputs (0major+32996minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <boost/interprocess/allocators/adaptive_pool.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <scoped_allocator>
#include <vector>

namespace bi = boost::interprocess;

template<class T> using alloc = bi::adaptive_pool<T,
                                    bi::managed_shared_memory::segment_manager>;
using ipc_row = std::vector<int, alloc<int>>;
using ipc_matrix = std::vector<ipc_row, std::scoped_allocator_adaptor<alloc<ipc_row>>>;

int main ()
{
    bi::managed_shared_memory s(bi::create_only, "Demo", 65536);

    // create vector of vectors in shared memory
    ipc_matrix v(s.get_segment_manager());

    // for all these additions, the inner vectors obtain their allocator arguments
    // from the outer vector's scoped_allocator_adaptor
    v.resize(1);
    v[0].push_back(1);
    v.emplace_back(2);
    std::vector<int> local_row = {1, 2, 3};
    v.emplace_back(local_row.begin(), local_row.end());

    bi::shared_memory_object::remove("Demo");
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/numeric/add_sat.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:13:5: expected a statement
    constexpr unsigned char b = std::add_sat<unsigned char>(UCHAR_MAX, 4); // saturated
    ^
/tmp/cppCode.cpp:23:5: expected a statement
    constexpr unsigned char e = std::add_sat<unsigned char>(251, a); // saturated
    ^
/tmp/cppCode.cpp:28:5: expected a statement
    constexpr signed char f = std::add_sat<signed char>(-123, -3); // not saturated
    ^
/tmp/cppCode.cpp:31:5: expected a statement
    constexpr signed char g = std::add_sat<signed char>(-123, -13); // saturated
    ^
Command exited with non-zero status 1
0.04user 0.01system 0:00.05elapsed 100%CPU (0avgtext+0avgdata 12140maxresident)k
0inputs+0outputs (0major+2627minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <climits>
#include <limits>
#include <numeric>

static_assert(CHAR_BIT == 8);
static_assert(UCHAR_MAX == 255);

int main()
{
    constexpr int a = std::add_sat(3, 4); // no saturation occurs, T = int
    static_assert(a == 7);

    constexpr unsigned char b = std::add_sat<unsigned char>(UCHAR_MAX, 4); // saturated
    static_assert(b == UCHAR_MAX);

    constexpr unsigned char c = std::add_sat(UCHAR_MAX, 4); // not saturated, T = int
        // add_sat(int, int) returns int tmp == 259,
        // then assignment truncates 259 % 256 == 3
    static_assert(c == 3);

//  unsigned char d = std::add_sat(252, c); // Error: inconsistent deductions for T

    constexpr unsigned char e = std::add_sat<unsigned char>(251, a); // saturated
    static_assert(e == UCHAR_MAX);
        // 251 is of type T = unsigned char, `a` is converted to unsigned char value;
        // might yield an int -> unsigned char conversion warning for `a`

    constexpr signed char f = std::add_sat<signed char>(-123, -3); // not saturated
    static_assert(f == -126);

    constexpr signed char g = std::add_sat<signed char>(-123, -13); // saturated
    static_assert(g == std::numeric_limits<signed char>::min()); // g == -128
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/numeric/bit_cast.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:7:28: expected ')'
static_assert(std::bit_cast<double>(u64v) == f64v); // round-trip
                           ^
/tmp/cppCode.cpp:7:35: expected a declaration
static_assert(std::bit_cast<double>(u64v) == f64v); // round-trip
                                  ^
/tmp/cppCode.cpp:7:36: expected a declaration
static_assert(std::bit_cast<double>(u64v) == f64v); // round-trip
                                   ^
/tmp/cppCode.cpp:7:41: expected a declaration
static_assert(std::bit_cast<double>(u64v) == f64v); // round-trip
                                        ^
/tmp/cppCode.cpp:7:43: expected a declaration
static_assert(std::bit_cast<double>(u64v) == f64v); // round-trip
                                          ^
/tmp/cppCode.cpp:7:50: expected a declaration
static_assert(std::bit_cast<double>(u64v) == f64v); // round-trip
                                                 ^
/tmp/cppCode.cpp:10:37: expected a declaration
constexpr auto f64v2 = std::bit_cast<double>(u64v2);
                                    ^
/tmp/cppCode.cpp:10:44: expected a declaration
constexpr auto f64v2 = std::bit_cast<double>(u64v2);
                                           ^
/tmp/cppCode.cpp:10:45: expected a declaration
constexpr auto f64v2 = std::bit_cast<double>(u64v2);
                                            ^
/tmp/cppCode.cpp:10:51: expected a declaration
constexpr auto f64v2 = std::bit_cast<double>(u64v2);
                                                  ^
Command exited with non-zero status 1
0.16user 0.02system 0:00.18elapsed 100%CPU (0avgtext+0avgdata 36484maxresident)k
0inputs+0outputs (0major+9377minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <bit>
#include <cstdint>
#include <iostream>

constexpr double f64v = 19880124.0;
constexpr auto u64v = std::bit_cast<std::uint64_t>(f64v);
static_assert(std::bit_cast<double>(u64v) == f64v); // round-trip

constexpr std::uint64_t u64v2 = 0x3fe9000000000000ull;
constexpr auto f64v2 = std::bit_cast<double>(u64v2);
static_assert(std::bit_cast<std::uint64_t>(f64v2) == u64v2); // round-trip

int main()
{
    std::cout
        << "std::bit_cast<std::uint64_t>(" << std::fixed << f64v << ") == 0x"
        << std::hex << u64v << '\n'
        << "std::bit_cast<double>(0x" << std::hex << u64v2 << ") == "
        << std::fixed << f64v2 << '\n';
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/numeric/complex/polar.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:10:5: expected a statement
    constexpr auto π_2{std::numbers::pi / 2.0};
    ^
/tmp/cppCode.cpp:10:46: expected ';'
    constexpr auto π_2{std::numbers::pi / 2.0};
                                             ^
/tmp/cppCode.cpp:18:9: expected a statement
        const auto θ{n * π_2};
        ^
/tmp/cppCode.cpp:18:24: expected ';'
        const auto θ{n * π_2};
                       ^
/tmp/cppCode.cpp:20:38: expected an expression
                  << std::polar(mag, θ) << " │ "
                                     ^
Command exited with non-zero status 1
0.27user 0.02system 0:00.29elapsed 100%CPU (0avgtext+0avgdata 52608maxresident)k
0inputs+0outputs (0major+14399minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <numbers>
using namespace std::complex_literals;

int main()
{
    constexpr auto π_2{std::numbers::pi / 2.0};
    constexpr auto mag{1.0};

    std::cout
        << std::fixed << std::showpos << std::setprecision(1)
        << "   θ: │ polar:      │ exp:        │ complex:    │ trig:\n";
    for (int n{}; n != 4; ++n)
    {
        const auto θ{n * π_2};
        std::cout << std::setw(4) << 90 * n << "° │ "
                  << std::polar(mag, θ) << " │ "
                  << mag * std::exp(θ * 1.0i) << " │ "
                  << std::complex(mag * cos(θ), mag * sin(θ)) << " │ "
                  << mag * (cos(θ) + 1.0i * sin(θ)) << '\n';
    }
}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/numeric/div_sat.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:6:21: expected ')'
    && (std::div_sat<int>(6, 3) == 2) // not saturated
                    ^
/tmp/cppCode.cpp:6:25: expected a declaration
    && (std::div_sat<int>(6, 3) == 2) // not saturated
                        ^
/tmp/cppCode.cpp:6:26: expected a declaration
    && (std::div_sat<int>(6, 3) == 2) // not saturated
                         ^
/tmp/cppCode.cpp:6:27: expected a declaration
    && (std::div_sat<int>(6, 3) == 2) // not saturated
                          ^
/tmp/cppCode.cpp:6:28: expected a declaration
    && (std::div_sat<int>(6, 3) == 2) // not saturated
                           ^
/tmp/cppCode.cpp:6:30: expected a declaration
    && (std::div_sat<int>(6, 3) == 2) // not saturated
                             ^
/tmp/cppCode.cpp:6:31: expected a declaration
    && (std::div_sat<int>(6, 3) == 2) // not saturated
                              ^
/tmp/cppCode.cpp:6:33: expected a declaration
    && (std::div_sat<int>(6, 3) == 2) // not saturated
                                ^
/tmp/cppCode.cpp:6:36: expected a declaration
    && (std::div_sat<int>(6, 3) == 2) // not saturated
                                   ^
/tmp/cppCode.cpp:6:37: expected a declaration
    && (std::div_sat<int>(6, 3) == 2) // not saturated
                                    ^
/tmp/cppCode.cpp:7:5: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
    ^
/tmp/cppCode.cpp:7:8: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
       ^
/tmp/cppCode.cpp:7:21: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                    ^
/tmp/cppCode.cpp:7:25: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                        ^
/tmp/cppCode.cpp:7:26: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                         ^
/tmp/cppCode.cpp:7:27: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                          ^
/tmp/cppCode.cpp:7:27: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                          ^
/tmp/cppCode.cpp:7:27: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                          ^
/tmp/cppCode.cpp:7:27: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                          ^
/tmp/cppCode.cpp:7:27: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                          ^
/tmp/cppCode.cpp:7:27: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                          ^
/tmp/cppCode.cpp:7:34: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                                 ^
/tmp/cppCode.cpp:7:36: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                                   ^
/tmp/cppCode.cpp:7:37: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                                    ^
/tmp/cppCode.cpp:7:38: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                                     ^
/tmp/cppCode.cpp:7:40: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                                       ^
/tmp/cppCode.cpp:7:43: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                                          ^
/tmp/cppCode.cpp:7:50: expected a declaration
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
                                                 ^
/tmp/cppCode.cpp:8:5: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
    ^
/tmp/cppCode.cpp:8:8: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
       ^
/tmp/cppCode.cpp:8:21: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
                    ^
/tmp/cppCode.cpp:8:30: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
                             ^
/tmp/cppCode.cpp:8:31: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
                              ^
/tmp/cppCode.cpp:8:32: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
                               ^
/tmp/cppCode.cpp:8:33: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
                                ^
/tmp/cppCode.cpp:8:35: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
                                  ^
/tmp/cppCode.cpp:8:36: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
                                   ^
/tmp/cppCode.cpp:8:38: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
                                     ^
/tmp/cppCode.cpp:8:41: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
                                        ^
/tmp/cppCode.cpp:8:42: expected a declaration
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
                                         ^
/tmp/cppCode.cpp:9:1: expected a declaration
);
^
Command exited with non-zero status 1
0.04user 0.01system 0:00.05elapsed 100%CPU (0avgtext+0avgdata 12160maxresident)k
0inputs+0outputs (0major+2586minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <climits>
#include <numeric>

static_assert
(""
    && (std::div_sat<int>(6, 3) == 2) // not saturated
    && (std::div_sat<int>(INT_MIN, -1) == INT_MAX) // saturated
    && (std::div_sat<unsigned>(6, 3) == 2) // not saturated
);

int main() {}
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/preprocessor/replace.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:5:1: expected a declaration
EXAMPLE(5)
^
/tmp/cppCode.cpp:5:1: expected a declaration
EXAMPLE(5)
^
/tmp/cppCode.cpp:5:1: expected a declaration
EXAMPLE(5)
^
/tmp/cppCode.cpp:5:9: expected a declaration
EXAMPLE(5)
        ^
/tmp/cppCode.cpp:5:1: expected a declaration
EXAMPLE(5)
^
/tmp/cppCode.cpp:5:1: expected a declaration
EXAMPLE(5)
^
/tmp/cppCode.cpp:5:1: expected a declaration
EXAMPLE(5)
^
/tmp/cppCode.cpp:5:1: expected a declaration
EXAMPLE(5)
^
/tmp/cppCode.cpp:5:9: expected a declaration
EXAMPLE(5)
        ^
/tmp/cppCode.cpp:5:1: expected a declaration
EXAMPLE(5)
^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:14: expected a declaration
SCAN(EXAMPLE(5))
             ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:14: expected a declaration
SCAN(EXAMPLE(5))
             ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:14: expected a declaration
SCAN(EXAMPLE(5))
             ^
/tmp/cppCode.cpp:6:6: expected a declaration
SCAN(EXAMPLE(5))
     ^
/tmp/cppCode.cpp:6:17: expected a declaration
SCAN(EXAMPLE(5))
                ^
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 3796maxresident)k
0inputs+0outputs (0major+174minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#define EMPTY
#define SCAN(x)     x
#define EXAMPLE_()  EXAMPLE
#define EXAMPLE(n)  EXAMPLE_ EMPTY()(n-1) (n)
EXAMPLE(5)
SCAN(EXAMPLE(5))
//====End
$HOME/.local/share/Zeal/Zeal/docsets/C++.docset/Contents/Resources/Documents/en.cppreference.com/w/cpp/ranges/adjacent_view.html
==CHECK==
/usr/bin/time ./cxx-nb-release -fsyntax-only -toolchain linux -nostdinc++ -I$HOME/local/gcc-14/include/c++/14.2.0  -I$HOME/local/gcc-14/include/c++/14.2.0/x86_64-pc-linux-gnu /tmp/cppCode.cpp
/tmp/cppCode.cpp:12:60: expected ')'
    for (int i{}; std::tuple t : v | std::views::adjacent<3>)
                                                           ^
Command exited with non-zero status 1
0.30user 0.01system 0:00.32elapsed 99%CPU (0avgtext+0avgdata 60072maxresident)k
0inputs+0outputs (0major+16298minor)pagefaults 0swaps
==rc:FAILED==
//====Start
#include <array>
#include <format>
#include <iostream>
#include <ranges>
#include <tuple>

int main()
{
    constexpr std::array v{1, 2, 3, 4, 5, 6};
    std::cout << "v = [1 2 3 4 5 6]\n";

    for (int i{}; std::tuple t : v | std::views::adjacent<3>)
    {
        auto [t0, t1, t2] = t;
        std::cout << std::format("e = {:<{}}[{} {} {}]\n", "", 2 * i++, t0, t1, t2);
    }
}
//====End

@robertoraggi
Copy link
Owner

@mingodad Thanks for your report. I believe adjacent was introduced in c++23, you can try to change the value of __cplusplus to 202302L in gcc_linux_toolchain.cc to see if the preprocessor will pick it up.
I will refresh the built-ins later this week.

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

2 participants