Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Oracle Studio 12.5/12.6 extern C static anonymous lambda compilation error when compiling ICU 65.1

rwave2000Oct 24 2019 — edited Oct 28 2019

Oracle Studio 12.6 produces the following error when compiling ICU 65.1

CC   -DU_HAVE_ELF_H=1 -DU_HAVE_TIMEZONE=0 -DU_HAVE_STRTOD_L=0  -I/build/scottz/build/build/SunOS_i386_32/icu/source/common   "-DDEFAULT_ICU_PLUGINS=\"/build/icu-65.1/solaris/ia32/lib/icu\" " -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENTATION  -mt  -std=c++11  -c -DPIC -KPIC -o umutex.o _umutex.cpp

"/build/scottz/build/build/SunOS_i386_32/icu/source/common/umutex.cpp", line 73: Warning: Deducing non-void lambda return type 'std::mutex*' from lambda without a single return statement.

"/build/scottz/build/build/SunOS_i386_32/icu/source/common/umutex.cpp", line 74: Warning: Deducing non-void lambda return type 'std::condition_variable*' from lambda without a single return statement.

"/build/scottz/build/build/SunOS_i386_32/icu/source/common/umutex.cpp", line 73: Error: icu_65::umtx_init::{lambda at umutex.cpp,73:17}::operator()() const and icu_65::umtx_init::{lambda at umutex.cpp,74:21}::operator()() const have same extern name "(".

1 Error(s) and 2 Warning(s) detected.

gmake[1]: *** [umutex.o] Error 2

I have produce a testcase that demonstrate the error.

#include <mutex>

#include <condition_variable>

namespace {

    std::mutex *initMutex;

    std::condition_variable *initCondition;

}

extern "C" {

    static void umtx_init ( ) {

        initMutex = [ ] ( ) { alignas ( std :: mutex ) static char storage [ sizeof ( std :: mutex ) ] ; return new ( storage ) std:: mutex ( ) ; } ( ) ;

        initCondition = [ ] ( ) { alignas ( std :: condition_variable ) static char storage [ sizeof ( std :: condition_variable) ] ; return new ( storage ) std :: condition_variable ( ) ; } ( ) ;

    }

}

$ CC -V && CC -std=c++11 t.cpp

CC: Studio 12.6 Sun C++ 5.15 SunOS_i386 2017/05/30

"t.cpp", line 11: Warning: Deducing non-void lambda return type 'std::mutex*' from lambda without a single return statement.

"t.cpp", line 12: Warning: Deducing non-void lambda return type 'std::condition_variable*' from lambda without a single return statement.

"t.cpp", line 11: Error: umtx_init::{lambda at t.cpp,11:21}::operator()() const and umtx_init::{lambda at t.cpp,12:25}::operator()() const have same extern name "(".

1 Error(s) and 2 Warning(s) detected.

in addition, using just using a single extern C static anonymous lambda causes compilation failure.

#include <mutex>

namespace {

    std::mutex *initMutex;

}

extern "C" {

    static void umtx_init ( ) {

        initMutex = [ ] ( ) { alignas ( std :: mutex ) static char storage [ sizeof ( std :: mutex ) ] ; return new ( storage ) std:: mutex ( ) ; } ( ) ;

    }

}



$ CC -V && CC -std=c++11 t.cpp

CC: Studio 12.6 Sun C++ 5.15 SunOS_i386 2017/05/30

"t.cpp", line 9: Warning: Deducing non-void lambda return type 'std::mutex*' from lambda without a single return statement.

1 Warning(s) detected.

Assembler: t.cpp

        "<null>", line 10 : Syntax error

        Near line: "    .globl "

        "<null>", line 11 : Syntax error

        Near line: "    .type "

        "<null>", line 77 : Syntax error

        Near line: "    call    ("

        "<null>", line 96 : Syntax error

        Near line: "    .group "

        "<null>", line 98 : Syntax error

        Near line: "    .section .text%"

        "<null>", line 100 : Syntax error

        Near line: "    .group "

        "<null>", line 102 : Syntax error

        Near line: "    .section .text%"

        "<null>", line 104 : Syntax error

        Near line: ""

        "<null>", line 168 : Syntax error

        Near line: "    .size "

        "<null>", line 242 : Syntax error

        Near line: "    .group "

        "<null>", line 244 : Syntax error

        Near line: "    .section .annotate%"

        "<null>", line 255 : Syntax error

        Near line: "    .4byte .text%"

        "<null>", line 256 : Syntax error

        Near line: "    .4byte .CG11 - .text%"

CC: ube failed for t.cpp

Comments

Post Details

Added on Oct 24 2019
1 comment
367 views