[llvm-bugs] [Bug 49804] New: Instantiation error when using SFINAE inside a class

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 1 08:06:25 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49804

            Bug ID: 49804
           Summary: Instantiation error when using SFINAE inside a class
           Product: libc++
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: denis at math.univ-lyon1.fr
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

When trying to use SFINAE to detect templated method, Clang triggers an
instantiation error on the expression that should invalidate the templated
helper overload, the helper being declared inside another class. When the
helper is declared in the current namespace directly, the code compiles and
works fine.

Here is a (almost) minimal code: https://godbolt.org/z/7jEf3xdj5

I expected this code to output "0" four times (detection failed) with this
snippet, and "1" four times if `DTEMPLATED` is defined (de-commenting line 5).

Clang (11, 10, trunk, ...) triggers an error during instantiation when using
`Test1` (helper wrapped inside a class): "no matching member function for call
to 'd'" or "no matching member function for call to 'd'" depending on the
tested class (`Dummy1` or `Dummy2`).

It works when using `Test2` instead, that is almost the same code but without
wrapping class.

I think it is a bug because of the successful compilation for Test2 and since
it works with GCC.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210401/c89bc07c/attachment.html>


More information about the llvm-bugs mailing list