1// (C) Copyright Beman Dawes 2009 2 3// Use, modification and distribution are subject to the 4// Boost Software License, Version 1.0. (See accompanying file 5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 7// See http://www.boost.org/libs/config for more information. 8 9// MACRO: BOOST_NO_RESTRICT_REFERENCES 10// TITLE: We cannot apply BOOST_RESTRICT to a reference type. 11// DESCRIPTION: We cannot apply BOOST_RESTRICT to a reference type 12 13#include <boost/config.hpp> 14 15namespace boost_no_restrict_references { 16 17#ifdef _MSC_VER 18#pragma warning(error:4227) 19#endif 20 21 22void sum2(int (& BOOST_RESTRICT a)[4], int (& BOOST_RESTRICT b)[4], int (&c)[4], int (&d)[4]) { 23 int i; 24 for (i = 0; i < 4; i++) { 25 a[i] = b[i] + c[i]; 26 c[i] = b[i] + d[i]; 27 } 28} 29 30int test() 31{ 32 int a[4] = { 1, 2, 3, 4 }; 33 int b[4] = { 3, 4, 5, 6 }; 34 int c[4] = { 0, 1, 3, 5 }; 35 int d[4] = { 2, 4, 6, 8 }; 36 37 sum2(a, b, c, d); 38 39 return 0; 40} 41 42#ifdef _MSC_VER 43#pragma warning(default:4227) 44#endif 45 46 47} 48