Bug 383319 - Classes declared in namespaces but defined outside are not imported
Summary: Classes declared in namespaces but defined outside are not imported
Status: RESOLVED NOT A BUG
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 2.20.3 (KDE Applications 16.08.3)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-09 14:48 UTC by Daniele E. Domenichelli
Modified: 2017-08-10 10:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniele E. Domenichelli 2017-08-09 14:48:26 UTC
A class declared in this way:

---
namespace test {
class test;
}

class test::foo
{
    test();
};
---

is not imported, only the namespace is created.

On the other side a class declared properly in this way

---
namespace test2 {
class foo
{
    test2();
};
}
---

imports both the namespace and the class.

The first example is valid c++ code, therefore I'd expect them to produce the same result.
Comment 1 Ralf Habacker 2017-08-09 16:23:30 UTC
(In reply to Daniele E. Domenichelli from comment #0)
> A class declared in this way:
> 
> ---
> namespace test {
> class test;
You declare class test to be a member of namespace test
> }
> 
> class test::foo
You define a class foo inside test, which is not declared in namespace test above
> {
>     test();
> };
> ---

This is not supported by the c++ standard. See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf

7.3.1.2 Namespace member definitions
2 Members of a named namespace can also be defined outside that namespace by explicit qualification of the name being defined, provided that the entity being defined was already declared in the namespace and the definition appears after the point of declaration in a namespace that encloses the declaration’s namespace.

The correct c++ fragments looks then 

---
namespace test {
class foo;
}

class test::foo
{
    test();
 };
----

Importing this code creates class test::foo.
Comment 2 Daniele E. Domenichelli 2017-08-10 09:41:25 UTC
You are right, sorry, that was all caused by a typo while trying to reproduce my issue that is actually different...

The problem is that the classes are generated, but the methods are not imported for example see the difference in the classes foo and bar generated by this:

---
namespace test {
class foo;

class bar
{
    bar();
};

} // namespace test

class test::foo
{
    test();
};
---
Comment 3 Ralf Habacker 2017-08-10 10:50:47 UTC
(In reply to Daniele E. Domenichelli from comment #2)
> The problem is that the classes are generated, but the methods are not
> imported for example see the difference in the classes foo and bar generated
> by this:
This ticket covers a different issue and has already been closed. Please open a different bug report