https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87748
Bug ID: 87748 Summary: G++-8 treats SFINAE as error Product: gcc Version: 8.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: timj at gnu dot org Target Milestone: --- Created attachment 44897 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44897&action=edit g++-8 SFINAE Error Test Case The following (reduced) code example uses SFINAE to discern argument types in a visitor pattern. The original bug report is here: https://github.com/tim-janik/beast/issues/72#issuecomment-432874963 It works well under clang-6 and g++-7.3. With g++-8.1.1 (and reportedly g++-8.2.1) a template substitution failure during a method presence check on std::string is promoted to an error, even though a std::false_type substitution variant exists that should be picked up instead. Not only do other compiler (versions) compile this correctly, but duplicating a seemingly unrelated static_assert in the code also "remedies" the g++-8 treatment of the failure as error, tested via -DWITHASSERT below. EXPECTED: $ g++ --version g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0 $ g++ -std=gnu++14 -Wall -O2 aidavisit.cc && ./a.out visit_string: some_string="A std::string" BUGGY BEHAVIOUR: $ g++ --version g++ (GCC) 8.1.1 20180712 (Red Hat 8.1.1-5) $ g++ -std=gnu++14 -Wall -O2 aidavisit.cc && ./a.out aidavisit.cc:19:77: error: 'class std::__cxx11::basic_string<char>' has no member named '__aida_visit__' $ g++ -std=gnu++14 -Wall -O2 aidavisit.cc -DWITHASSERT && ./a.out visit_string: some_string="A std::string"