1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // UNSUPPORTED: c++98, c++03, c++11 11 12 // <propagate_const> 13 14 // element_type* propagate_const::operator->(); 15 16 #include <experimental/propagate_const> 17 #include "propagate_const_helpers.h" 18 #include <cassert> 19 20 using std::experimental::propagate_const; 21 22 typedef propagate_const<X> P; 23 24 constexpr P f() 25 { 26 P p(1); 27 *(p.operator->()) = 2; 28 return p; 29 } 30 31 int main() { 32 constexpr P p = f(); 33 static_assert(*(p.operator->())==2,""); 34 } 35