Skip to content

Commit

Permalink
Clang 3.1 - 3.3で警告が出るバグを備考に記述
Browse files Browse the repository at this point in the history
Clangだと警告が出ること、またClangのバグであることを追記しました。

以下の根拠(N3337 C++11)よりClangのバグだと判断しました。
§ 8.3.5 p6
The effect of a cv-qualifier-seq in a function declarator is not the same as adding cv-qualification on top
of the function type. In the latter case, the cv-qualifiers are ignored.

§20.9.4.1 p2
For any given type T, the result of applying one of these templates to T and to cv-qualified T shall yield the
same result.
  • Loading branch information
RiSK (sscrisk) committed Aug 9, 2013
1 parent 1813e7d commit 7f488ae
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions reference/type_traits/is_function.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,21 @@ int main(){}
###処理系
- [GCC, C++0x mode](/implementation#gcc.md): 4.5.3, 4.6.1, 4.7.0
- [Visual C++](/implementation#visual_cpp.md) 10.0
- [Clang](/implementation#clang.md) 3.1, 3.2, 3.3

####備考
上の例でコンパイラによってはエラーになる。GCC 4.3.4, 4.5.3, Visual C++ 10.0 は [`integral_constant`](./integral_constant-true_type-false_type.md)`operator bool()` を持っていないためエラーになる。また、Visual C++ 10.0 はコンパイラのバグのために関数への右辺値参照を用いるとエラーになる。

Clang 3.1 - 3.3 では以下のような警告が出るが、これは[Clangのバグ](http://llvm.org/bugs/show_bug.cgi?id=16654)である。
```
prog.cc:15:32: warning: qualifier on function type 'f' (aka 'void ()') has unspecified behavior
static_assert(std::is_function<const f>::value == true, "const f is function");
^~~~~~~
prog.cc:16:32: warning: qualifier on function type 'f' (aka 'void ()') has unspecified behavior
static_assert(std::is_function<volatile f>::value == true, "volatile f is function");
^~~~~~~~~~
prog.cc:17:32: warning: qualifier on function type 'f' (aka 'void ()') has unspecified behavior
static_assert(std::is_function<const volatile f>::value == true, "const volatile f is function");
^~~~~~~~~~~~~~~~
3 warnings generated.
```

0 comments on commit 7f488ae

Please sign in to comment.