Skip to content

Instantly share code, notes, and snippets.

@seanbaxter
seanbaxter / false-positives.md
Last active October 23, 2026 22:22
False positives for P4415R0

Safe-code rejections: individual reproducers

463 cases: 80 individually constructed examples followed by 383 generated type-operation cases.

Each Compiler Explorer link embeds the complete case source and selects gcontracts-p4324-trunk with the case’s language mode, -pedantic-errors -pthread -O0. The links use Compiler Explorer’s clientstate URL format.

Recorded rejections use the October 23, 2026 GCC archive, revision 53c3fe8d990028550ba820894b07a3e1af2ef77b. Compiler Explorer selects a moving nightly, so future results may differ. All listed cases were also rejected locally at -O2 and independently compiled and ran without enforcement under GCC 16 with AddressSanitizer and UBSan. These are reproducer counts; some share root causes or reflect intentional restrictions.

# Case Compiler Explorer Brief description
@seanbaxter
seanbaxter / life.cxx
Last active July 12, 2021 16:26
Game of life with CIA
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
// A board is uniquely determined by its height, width and cell data.
// The timestep is not part of the board.
template<int height, int width, int... cells>
struct board_t {
// Convert the cell data to a string constant.
static const char string[] {
import generators ;
using clang : : /usr/bin/circle ;
generators.override clang.compile.c.pch : pch.default-c-pch-generator ;
generators.override clang.compile.c++.pch : pch.default-cpp-pch-generator ;
@seanbaxter
seanbaxter / triangle.cxx
Created September 25, 2020 21:18
single-source vulkan triangle
#include <stdio.h>
#include <memory>
#include <iostream>
#include <fstream>
#include <vulkan/common.h>
// Shader interface helper variables.
template<auto index, typename type_t = @enum_type(index)>
[[using spirv: in, location((int)index)]]
type_t shader_in;
@seanbaxter
seanbaxter / sprites.cxx
Last active September 11, 2020 02:13
compiled sprites with SW framebuffer
#include <stb_image.h>
#include <string>
#include <vector>
#include <gl3w/GL/gl3w.h>
#include <GLFW/glfw3.h>
template<typename type_t>
const char* enum_to_string(type_t e) {
static_assert(std::is_enum_v<type_t>);
switch(e) {
@seanbaxter
seanbaxter / appglfw.hxx
Last active March 24, 2021 06:25
Circle glTF viewer. C++ shaders.
#pragma once
// #include <imgui.h>
// #include <examples/imgui_impl_glfw.h>
// #include <examples/imgui_impl_opengl3.h>
#include <stb_image.h>
#include <gl3w/GL/gl3w.h>
#include <GLFW/glfw3.h>
#include <cmath>
#include <cstdio>
#include <cfloat>
@seanbaxter
seanbaxter / Terminal
Last active August 12, 2020 21:32
Loading vert + tesc shader in one module segfaults nv driver in first call to glSpecializeShader.
$ glslc --target-env=opengl --target-spv=spv1.5 -o vert.spv vert.vert
$ glslc --target-env=opengl --target-spv=spv1.5 -o tesc.spv tesc.tesc
$ spirv-link vert.spv tesc.spv -o program.spv
$ clang++-9 segfault.cxx -lGL -lgl3w -lsfml-system -lsfml-window -lsfml-graphics -o segfault
$ ./segfault
Loaded spv: 1908 bytes
spv loaded
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff1dc7a54 in ?? () from /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.450.57
@seanbaxter
seanbaxter / bitfield.cxx
Created October 10, 2019 16:10
Bitfield width specifiers
#include <cstdio>
int read_value(const char* prompt) {
puts(prompt);
int x = 0;
scanf("%d", &x);
return x;
}
struct S {
#include <cstdio>
#include <type_traits>
#include <algorithm>
#include <utility>
#include <map>
#include <vector>
#include <tuple>
template<typename type_t>
struct foo_t {
'A,E Au aoeu
aoe
u
aoeu
aoe