https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108347
Bug ID: 108347 Summary: Incorrect error: ambiguous template instantiation Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: CoachHagins at gmail dot com Target Milestone: --- Created attachment 54222 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54222&action=edit C++ source - no include directives The attached code is a single .cpp file, as it contains no #include directives. I have also posted on compiler explorer here: https://godbolt.org/z/jjEPKdx8Y The code compiles fine with all versions of clang from 7 up through the latest branch on CE. The code FAILS to compile with gcc, all versions from 7 up through the latest branch on CE. There are THREE #defines in the included code, which provide three different "fixes" to make the code compile. The command g++ -std=c++17 -DFIX0=0 -DFIX1=0 -DFIX2=0 will fail to compile with an ambiguous template instantiation error. However, all of the following will allow the code to compile. Hopefully, the various "fixes" will help identify the underlying issue(s). g++ -std=c++17 -DFIX0=0 -DFIX1=0 -DFIX2=1 g++ -std=c++17 -DFIX0=0 -DFIX1=1 -DFIX2=0 g++ -std=c++17 -DFIX0=0 -DFIX1=1 -DFIX2=1 g++ -std=c++17 -DFIX0=1 -DFIX1=0 -DFIX2=0 g++ -std=c++17 -DFIX0=1 -DFIX1=0 -DFIX2=1 g++ -std=c++17 -DFIX0=1 -DFIX1=1 -DFIX2=0 g++ -std=c++17 -DFIX0=1 -DFIX1=1 -DFIX2=1