[llvm-bugs] [Bug 27402] New: __restrict qualifier not recognized in template specialization

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 18 07:19:46 PDT 2016


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

            Bug ID: 27402
           Summary: __restrict qualifier not recognized in template
                    specialization
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bkietz.borken at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

I tried to write a trait class for detecting `__restrict` qualification on
references/pointers:

```
template <typename T>
struct is_restrict : std::false_type {};

template <typename T>
struct is_restrict<T * __restrict> : std::true_type {};

template <typename T>
struct is_restrict<T & __restrict> : std::true_type {};

template <typename T>
struct is_restrict<T && __restrict> : std::true_type {};

static_assert(is_restrict<int & __restrict>::value, "int & __restrict");
```

This static_assert passed in GCC and MSVC, but failed in Clang. The
specialization for restrict pointer functioned as expected.

http://melpon.org/wandbox/permlink/2BEkXcmEE0MmOhwl

-- 
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/20160418/b4401bb3/attachment.html>


More information about the llvm-bugs mailing list