\section{C++ Reference in Data-Sharing Clauses}
\cppspecificstart
\label{sec:cpp_reference}
\index{clauses!data-sharing, C++ reference in}
\index{data-sharing clauses, C++ reference in}

C++ reference types are allowed in data-sharing attribute clauses as of OpenMP 4.5, except
for the \code{threadprivate}, \code{copyin} and \code{copyprivate} clauses.  
(See the Data-Sharing Attribute Clauses Section of the 4.5 OpenMP specification.)
When a variable with C++ reference type is privatized, the object the reference refers to is privatized in addition to the reference itself.
The following example shows the use of reference types in data-sharing clauses in the usual way.
Additionally it shows how the data-sharing of formal arguments with a C++ reference type on an orphaned task generating construct is determined implicitly. (See the Data-sharing Attribute Rules for Variables Referenced in a Construct Section of the 4.5 OpenMP specification.)


\cppnexample[4.5]{cpp_reference}{1}
\cppspecificend
