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

            Bug ID: 23461
           Summary: SFNAE-based constructors error-out when accessed via
                    constructor inheritance
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Created attachment 14304
  --> https://llvm.org/bugs/attachment.cgi?id=14304&action=edit
Sample code that shows the failure in action.

If we compile the attached code, with

/some/where/llvm.236909/bin/clang++ -std=c++11 -o sfnae-fail sfnae-fail.cpp

we get:

/some/where/llvm.236909/bin/../include/c++/v1/random:1867:28: error: no type
      named 'type' in 'std::__1::enable_if<false, void>'; 'enable_if' cannot be
      used to disable this declaration
  ...enable_if<__is_seed_sequence<_Sseq,
linear_congruential_engine>::value>:...
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sfnae-fail.cpp:7:19: note: in instantiation of member function
      'std::__1::linear_congruential_engine<unsigned int, 48271, 0,
      2147483647>::linear_congruential_engine' requested here
    using Engine::Engine;               // Inherited constructor
                  ^
sfnae-fail.cpp:21:49: note: while substituting deduced template arguments into
      function template 'inherited' [with _Sseq = int]
    inherited<std::default_random_engine>       fails(0);
                                                ^
1 error generated.

The issue seems to be related to SFNAE not working when a constructor is
inherited. If we access the constructor directly (i.e., no through
inheritance), it works fine.  Similarly, if we comment out the SFNAE
constructor (which isn't even the one we want in this code), it compiles fine
with constructor inheritance.

The failure occurs on both trunk and 3.6 (and earlier).  GCC 5.1 and earlier
show no issue with the code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to