This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 179048 - Unable to resolve using of global function in namespace
Summary: Unable to resolve using of global function in namespace
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 normal (vote)
Assignee: nnnnnk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-26 13:02 UTC by yuriy_lalym
Modified: 2011-01-31 17:54 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yuriy_lalym 2009-12-26 13:02:36 UTC
In main.cpp

#include <cstdio>
#include <cstdlib>

int main(int argc, char** argv)
{
    const int buf_size = 128;
    char buf[buf_size];
    std::snprintf(buf, buf_size, "Error in"); <<== Unable to resolve identifier

    return (EXIT_SUCCESS);
}

g++ -std=c++0x   -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++ -std=c++0x    -o dist/Debug/GNU-Linux-x86/cppapplication_1 build/Debug/GNU-Linux-x86/main.o  
BUILD SUCCESSFUL (total time: 232ms)

-----------------------------
Additional:
-----------------------------
yura@suse:~> g++ -v
Using built-in specs.
Target: x86_64-suse-linux
....
gcc version 4.4.1 [gcc-4_4-branch revision 150839] (SUSE Linux)
Comment 1 yuriy_lalym 2009-12-27 08:03:21 UTC
In main.cpp

#include <stdlib.h>
#include <cstdio>

void myfunc() {}

namespace std
{
    using ::myfunc;
    using ::snprintf;
}

int main(int argc, char** argv) {
    std::myfunc();                   <<== Unable to resolve identifier myfunc
    return (EXIT_SUCCESS);
}

g++    -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++     -o dist/Debug/GNU-Linux-x86/cppapplication_1 build/Debug/GNU-Linux-x86/main.o  
BUILD SUCCESSFUL (total time: 484ms)

------------------------------------------------------------------------------

In main.cpp ( Version without namespace std {using ::myfunc;} )

#include <stdlib.h>
#include <cstdio>

void myfunc() {}

int main(int argc, char** argv) {
    std::myfunc();                   <<==Ok, Unable to resolve identifier myfunc
    return (EXIT_SUCCESS);
}

g++    -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:23: error: ‘myfunc’ is not a member of ‘std’
BUILD FAILED (exit value 2, total time: 280ms)
Comment 2 yuriy_lalym 2009-12-27 08:10:16 UTC
The last was checked on NetBeans IDE Dev (Build 200912240201)