catchorg / catchorg/Catch2

TEMPLATE_TEST_CASE_SIG error

Open
#2,617 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

**Describe the bug**
Compilation (gcc-12) error when trying to use `TEMPLATE_TEST_CASE_SIG`.
Only in v3.x, no bug in v2.x.

**Expected behavior**
Expect simple `TEMPLATE_TEST_CASE_SIG` example to compile but I am getting:
`error: expected constructor, destructor, or type conversion before '(' token`

**Reproduction steps**
See [godbolt example](https://godbolt.org/z/rbYvaf4fq)

**Platform information:**
- OS: Linux Ubuntu 20.04.5
- Compiler+version: GCC 12.2 (or trunk), clang-15
- Catch version: 3.2.1 (or devel)

(Same issue on Compiler Explorer)

Contributor guide

Open the contributing guide

Research direction

Start with the linked Compiler Explorer reproduction for TEMPLATE_TEST_CASE_SIG and compare the Catch2 v3.2.1 or devel behavior with v2.x using GCC 12.2 and clang-15. Trace the macro's definition and expansion to identify why the example fails to compile, then confirm the simple example compiles on the reported toolchains.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.