My Oracle Support Banner

Unexpected Compiler Error: "Call to 'f' is ambiguous" (Doc ID 2750326.1)

Last updated on MAY 05, 2021

Applies to:

Oracle Solaris Studio - Version 12.6 to 12.6 [Release 12]
Information in this document applies to any platform.

Symptoms

On : 12.6 version, c++

Given the following code

template <typename T>             void f(T*, void*,       T&);
template <typename T, typename A> void f(T*, void*, const A&);
const struct Y { Y( ) { } } y;
int main( ) { f(&y, 0, y); }

when compiling it with the following command line

# <STUDIO_12.6_INSTALL_DIR>/bin/CC -c <SOURCE_FILE>

the compilation fails with the following error

"<SOURCE_FILE>", line 4: Error: Call to 'f' is ambiguous.
"<SOURCE_FILE>", line 1: Note: Viable candidate 'void f<const Y>(const Y*, void*, const Y&)'.
"<SOURCE_FILE>", line 2: Note: Viable candidate 'void f<const Y, Y>(const Y*, void*, const Y&)'.
1 Error(s) detected.

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.